Saturday 6 September 2014

C Program to print the first N Natural Numbers in Reverse Order

Program:

#include<stdio.h>
#include<conio.h>
void main( )
{
             int c,n;
             printf("\nEnter N value: ");
             scanf("%d", &n);
             c = n;
             while(c>0)
             {
                      printf("\n %d",c);
                      c--;
              }
              getch( );
}

Input/Output:

Enter N Value: 5
5
4
3
2
1



0 comments:

Post a Comment