In this easy coded program, you will learn how to print numbers from 1 up to the end decided by the user using for loop.
You will have to take input of the last number that the user wants to print and simply write the code for its execution.
---------------------------------------------------------------------------
Output
Hope you found this 'C Program to Print Numbers from 1 to 'n' (for Loop)' easy, simple and helpful!
Try to solve more queries by yourself by referring more examples from BEGINC. Here you will get the most easiest code to each and every query. Keep practicing. More programs are coming.
You will have to take input of the last number that the user wants to print and simply write the code for its execution.
---------------------------------------------------------------------------
Program to Print Numbers from 1 to 'n' (for Loop)
/*Print Numbers from 1 to n- for loop*/
|
#include<stdio.h>
|
void main()
|
{
|
int
i, num;
|
i=1;
|
printf("Enter Number: ");
|
scanf("%d", &num);
|
for(;
i<=num;
i++)
|
{
|
printf("%d\t",i);
|
}
|
}
|
Output
Enter Number: 7
1 2 3 4 5 6 7
---------------------------------------------------------------------------Hope you found this 'C Program to Print Numbers from 1 to 'n' (for Loop)' easy, simple and helpful!
Try to solve more queries by yourself by referring more examples from BEGINC. Here you will get the most easiest code to each and every query. Keep practicing. More programs are coming.
Comments
Post a Comment
Please do not comment any spam links in the comment box.