Program to print 1 to n numbers using for loop

1737
program to print 1 to n numbers using for loop
#include<stdio.h>
#include<conio.h>
void main()
{
 int i,n;  /* i for loop counter, n for the extreme boundary */
 clrscr();
 printf("\n Enter the upper limit\n");
 scanf("%d",&n);
 printf("\n Numbers from 1 to %d are \n",n);
 for(i=1;i<=n;i++)     /* the loop which repeats 'n' times */
     printf("%5d",i);  /* each time the condition gives true the value 
                            of 'i' gets printed. */
getch();
}
  Output
  Enter the upper limit
  10
  Numbers from 1 to n are
    1  2  3   5  6  7  8  9  10

 

 

 

program to print 1 to n numbers using for loop c program to print 1 to n numbers using for loop write a program to print 1 to n numbers using for loop c program to print numbers from 1 to n using for loop print number 1 to n