write a program to print N natural numbers using while loop
Answers
Answered by
2
#include <stdio.h>
int main()
{
int i, end;
/*
* Input a number from user
*/
printf("Print all natural numbers from 1 to : ");
scanf("%d", &end);
/*
* Print natural numbers from 1 to end
*/
i=1;
while(i<=end)
{
printf("%d\n", i);
i++;
}
return 0;
}
Hope it helps
MugdhaH:
thanks so much
Similar questions