Saturday, May 13, 2023

write A programme to print all natural number from 1 to n using while loop

 //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

print a multiplication table of any integer taking from user

 // print a multiplication table of any integer taking from user  #include "stdio.h" int main () { int n,mul,i; printf ("...