Print its elements in reverse order

Description:

Using pointers to read in an array of integers and print its elements in reverse order. Test Case 1 Input (stdin) 5 11 22 33 44 55 Expected Output 55 44 33 22 11 Test Case 2 Input (stdin) 7 98 78 98 54 52 10 78 Expected Output 78 10 52 54 98 78 98

Program :

#include <stdio.h>

int main()

{

int n, c, d, a[100], b[100];  

   scanf("%d", &n);

   for (c = 0; c < n ; c++)

      scanf("%d", &a[c]);

   for (c = n - 1, d = 0; c >= 0; c--, d++)

      b[d] = a[c];

   for (c = 0; c < n; c++)

      a[c] = b[c];

   for (c = 0; c < n; c++)

      printf("%d ", a[c]);

return 0;

}