//write A programme to print all natural number from 1 to n using while loop
#include "stdio.h"
int main ()
{
int n,i;
printf ("Enter the last number:\n ");
scanf ("%i",&n);
i=1;
while(i<=n){
printf ("%i\n",i);
i++;
}
return 0;
}
output output output Enter the last number:
10
The series is :
1
2
3
4
5
6
7
8
9
10
No comments:
Post a Comment