C Program to Print Natural Numbers From N to 1 in Reverse Order

In this tutorial, i am going to show you how to c program to print all natural numbers from n (10, 100, 500, 1000, etc) to 1 with the help of for loop, while loop and recursion function.

C Programs to Print Natural Numbers from N to 1

  • C Program to Print Natural Numbers From N to 1 in Reverse Order using While Loop
  • C Program to Print Natural Numbers From N to 1 in Reverse Order using For Loop
  • C Program to Print Natural Numbers From N to 1 in Reverse Order using Recursion

C Program to Print Natural Numbers From N to 1 in Reverse Order using While Loop

/* C Program to Print Natural Numbers in reverse using While Loop */
 
#include<stdio.h>
int main()
{
  	int Number, i;
  
    printf("\n Please Enter any Integer Value  : ");
  	scanf("%d", &Number);
  	
  	i = Number;
  	printf("\n List of Natural Numbers from %d to 1 are \n", Number);  	
	
	while(i >= 1)
  	{
    	printf(" %d \t", i);
    	i--;
  	}
  
  	return 0;
}

The result of the above c program; as follows:

Please Enter any Integer Value  : 10
List of Natural Numbers from 10 to 1 are 
 10 	 9 	 8 	 7 	 6 	 5 	 4 	 3 	 2 	 1 	

C Program to Print Natural Numbers From N to 1 in Reverse Order using For Loop

/* C Program to Print Natural Numbers from 1 to N using For Loop */
 
#include<stdio.h>
int main()
{
  	int Number, i;
  
  	printf("\n Please Enter any Integer Value  : ");
  	scanf("%d", &Number);
  	
  	printf("\n List of Natural Numbers from %d to 1 are \n", Number);  	
	for(i=Number; i>=1; i--)
  	{
    	printf(" %d \t", i);
  	}
  
  	return 0;
}

The result of the above c program; as follows:

Please Enter any Integer Value  : 10
List of Natural Numbers from 10 to 1 are 
 10 	 9 	 8 	 7 	 6 	 5 	 4 	 3 	 2 	 1 	

C Program to Print Natural Numbers From N to 1 in Reverse Order using Recursion

#include<stdio.h>  
  
void display(int);  
  
int main()  
{  
    int limit;  
  
    printf("Please Enter any Integer Value  : ");
    scanf("%d", &limit);  
  
    printf("\nNatural Numbers from 1 To %d are:", limit);  
    display(limit);  
  
    return 0;  
}  
  
void display(int num)  
{  
    if(num <= 0)  
        return; 
    else  
      printf(" %d ", num);  
      display(num-1); 
  
}  

The result of the above c program; as follows:

Please Enter any Integer Value  : 10
Natural Numbers from 1 To 10 are: 10  9  8  7  6  5  4  3  2  1 

Be First to Comment

Leave a Reply

Your email address will not be published.