C Program to Print First n Numbers in Reverse Order using While loop

C Program to Print First n Numbers in Reverse Order using While loop

Write C Program to Print First n Numbers in Reverse Order using While loop

//WAP to print first n natural number in reverse order

#include <stdio.h>

int main()
{
	int n;

	printf("Enter the number :--> ");
	scanf("%d", &n);

	int i = n;

	while(i > 0)
	{
		printf("%d\n", i);
		i--;
	}
		return 0;
}

Output:

Enter the number :--> 5
5
4
3
2
1