Program to print all numbers from m to n using for loop

0
29
#include<stdio.h>
#include<conio.h>
void main()
{
 int i,n,m;  /* i for loop counter, m is lower limit, n for lower limit */
 clrscr();
 printf("\n Enter lower limit and upper limit");
 scanf("%d%d", &m, &n);
 printf("\n Numbers from %d to %d are \n", m, n);
 for(i=m; i<=n; i++)
     printf("%5d",i);
getch();
}
  Output:
  Enter lower limit and upper limit
  10 20
  Numbers from 10 to 20 are 
  10 11 12 13 14 15 16 17 18 19 20

 

 

 

Program to print all numbers from m to n using for loop C Program to print all numbers from m to n using for loop Program to print all numbers from m to n using for loop in c program to print m to n numbers for loop programs loop program

LEAVE A REPLY

Please enter your comment!
Please enter your name here