C Program To Print Reverse Order And Print Sum Of Its Element Of An Array

#include <stdio.h>
int main()
{
     int a[5], rev[5], i, j;
     printf("Enter 5 Numbers:\n\n");
     for(i=0; i<5; i++)
          scanf("%d", &a[i]);
     printf("\nElements in Array:\n\n");
     for(i=0; i<5; i++)
          printf(" %d",a[i]);
     j=0;
     for(i=4; i>=0; i--)
     {
          rev[j] = a[i];
          j++;
     }
     /* Prints the reversed array*/
     printf("\n\nReversed array is : ");
     for(i=0; i<5; i++)
          printf("%d ", rev[i]);
     return 0;
}

Output:


		

Leave a Comment