Sunday, 23 October 2016

Write a program to print an array in reverse order?

Write a program to print an array in reverse order?

/* ##################################
      Girfa : Student Help
      Reverse an array
      for more program visit : http://girfahelp.blogspot.in/2012/09/some-program-of-c-language.html
   ################################### */

#include<stdio.h>
#include<conio.h>
void main()
{
      int ar[5],i;
      clrscr();
      for(i=0;i<5;i++)
      {
            printf("Enter %d position number>> ",i+1);
            scanf("%d",&ar[i]);
      }
      printf("\n\tOriginal Input\n");
      for(i=0;i<5;i++)
            printf("\t%d",ar[i]);
      printf("\n\tReverse Order Printing\n");
      for(i--;i>=0;i--)
            printf("\t%d",ar[i]);
      getch();
}

 Download Source Code