c-programs-basics
This c program will print 10 to 1 numbers in descending order. We will perform this program using While Loop, Do While Loop and For Loop.

C Program To Print 10 to 1 Numbers Using While Loop

#include<stdio.h>
#include<conio.h>
void main()
{
 int n;
 clrscr();

 printf("\n"); //for new line

 // While Loop

 n=10;         //Initialize
 while(n>=1)   // Condition
 {
  printf(" %d",n);
  n--;     // Decrement
 }

 getch();

}
Output :
c-program-print-10-1-numbers-output



Display 10-1 Numbers using do..while loop

#include<stdio.h>
#include<conio.h>
void main()
{
 int n;
 clrscr();

 printf("\n"); //for new line

 // Do While Loop
 n=10;  // Initialize
 do
  {
   printf(" %d",n);
   n--;          // Decrement
  }
  while(n>=1); // Condition


 getch();
 }

C Program To Print Numbers From 10 To 1 Using For Loop

#include<stdio.h>
#include<conio.h>
void main()
{
 int n;
 clrscr();

 printf("\n"); //for new line

  //  For loop
 //  (initialize; condition ; increment)

 for(n=10;n>=1;n--)
 {
   printf(" %d",n);
 }

 getch();

}
To Run this program in DevC++ we have to make some changes in the above program, after changes the code will look like this:
#include<stdio.h>

int main()
{
 int n;
 
 printf("\n"); //for new line

  //  For loop
 //  (initialize; condition ; increment)

 for(n=10;n>=1;n--)
 {
   printf(" %d",n);
 }

 getch();
return 0;
}
Output : 
c-program-print-10-1-numbers-output





In this way, we can easily display numbers in any range using different types of loops.