## Algorithm

Problem Name: Array Reversal

In this HackerRank Functions in C programming problem solution,

Given an array, of size n, reverse it.

Example: If array, arr = |1, 2, 3, 4, 5|, after reversing it, the array should be, arr = |5, 4, 3, 2, 1|

Input Format

The first line contains an integer, n, denoting the size of the array. The next line contains n space-separated integers denoting the elements of the array.

Constraints

1 <= n <= 1000

1 <= arri <= 1000 , where arri is the i **th element of the array.

Output Format

The output is handled by the code given in the editor, which would print the array.

Sample Input 0

6
16 13 7 2 1 12


Sample Output 0

12 1 2 7 13 16


## Code Examples

### #1 Code Example with C Programming

Code - C Programming


#include <stdio.h>
#include <stdlib.h>

int main()
{
int i,j,k;
int n,m;
scanf("%d",&n);
int a[n];

for(i=0;i < n;i++)
{
scanf("%d",&a[i]);
}

for(i=n-1;i>=0;i--)

{
printf("%d ",a[i]);
}

return 0;
}

Copy The Code &

Input

cmd
6 16 13 7 2 1 12

Output

cmd
12 1 2 7 13 16