C program to print 1 to 100 without using Loop

 

#include <stdio.h>

int main()
{
    int data = 0;
begin:
    data = data + 1;
    printf("%d ", data);

    if (data < 100)
    {
        goto begin;
    }
    return 0;
}

 

#include <stdio.h>

int main()
{
    static int data = 1;
    if (data <= 100)
    {
        printf("%d ", data++);
        main();
    }
    return 0;
}

 

#include <stdio.h>

// Prints numbers from 1 to num
void print1toN(unsigned int num)
{
    if(num > 0)
    {
        print1toN(num - 1);
        printf("%d ", num);
    }
    return;
}

int main()
{
    print1toN(100);

    return 0;
}