Explanation of the Number Printing Program
This C program prints a sequence of numbers starting from 1 up to the number entered by the user. It uses a while loop to repeatedly increase the value of fno by 1 in each iteration.
The program runs the loop until the value of fno becomes greater than the last number (lno) entered by the user. This results in printing all natural numbers from 1 up to the specified limit.
What the Program Does
- Starts with fno = 1.
- Asks the user to enter the last number (lno).
- Checks the condition fno ≤ lno using a while loop.
- Prints each number during the loop.
- Increases fno by 1 every time: fno = fno + 1.
- Stops when fno becomes greater than lno.
- Uses clrscr() and getch() for Turbo C++ screen control.
Example Input
Enter the last number: 10
Example Output
1 2 3 4 5 6 7 8 9 10
Summary:
This program simply prints all natural numbers from 1 up to any number entered by the user.
It demonstrates the use of loops, increment operations, and basic console input/output in C programming.
