wap to print n natural numbers by using while loop

 


#include <stdio.h>
 int main() 
    int n,i=1;

 printf("how many digit do you want to print ");
 scanf("%d",&n);

 while (i <= n)
 {
    printf("\n %d",i);
    i++;

 } 

output :
 how many digit do you want to print 6 1 2 3 4 5 6

Comments