C Program To Print 1 to N in Descending Order Using Recursion
♣ Try it Out ::
#include<stdio.h>
#include<conio.h>
DescendingOrder(int n)
{
if(n == 0) return;
printf("%d ", n);
DescendingOrder(n-1);
}
main()
{
int N;
printf("Enter the n'th number: ");
scanf("%d", &N);
printf("Numbers from 1 to %d in descending order: \n", N);
DescendingOrder(N);
getch();
return(0);
}
♣ Output ::
Enter the n'th number: 15 Numbers from 1 to 15 in descending order: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
♣ Downloads ::
Comments
Post a Comment