This c program example demonstrate that how to print 1 to 100 without using any loop in c program. In this program actually function called itself each and every time. So we can also called this program as program of recursive function.
C program to print 1 to 100 without any loop.
#include<stdio.h>
void main()
{
int no=1;
clrscr();
print(no);
getch();
}
int print(no)
{
if(no<=100)
{
printf("%d ",no);
print(no+1);
}
}
void main()
{
int no=1;
clrscr();
print(no);
getch();
}
int print(no)
{
if(no<=100)
{
printf("%d ",no);
print(no+1);
}
}
0 comments:
Post a Comment