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

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including 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. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *