C program to print numbers from 1 to N using while loop
Here, N is the limit of the number, for example – if you want to print the numbers from 1 to 10 or 1 to 100 then 10 or 100 will be the value of N. In this C program, N will be entered by the user.
To print the numbers from 1 to N,
- We will declare two variables 1) for loop counter (number) and 2) for limit (n).
- We will check the condition whether loop counter is less than or equal to N, if condition is true numbers will be printed.
- If condition is false – loop will be terminated.
Program to print numbers from 1 to N using while loop in C
Output
need an explanation for this answer? contact us directly to get an explanation for this answer