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

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

C program to print all natural numbers from n to 1; Through this tutorial, we will learn how to c program to print all natural numbers from n (10, 100, 500, 1000, etc) to 1 using for loop, while loop and recursion function.

Programs to Print Natural Numbers from N to 1 in C

  • 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 output 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 output 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 output 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 

Recommended C Programs

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published.