TASK
Given an array, of size , reverse it.
Example: If array, , after reversing it, the array should be, .
Input Format
The first line contains an integer, , denoting the size of the array. The next line contains space-separated integers denoting the elements of the array.
Constraints
, where is the element of the array.
Sample Input 0
6
16 13 7 2 1 12
Sample Output 0
12 1 2 7 13 16 PROGRAM CODE#include <stdio.h>#include <stdlib.h>void reversearr(int arr[], int start,int end){ while(start<end) { int temp =arr[start]; arr[start]=arr[end]; arr[end]= temp; start++; end--; }}
int main(){ int n; scanf("%d",&n); int arr[n]; for(int i=0;i<n;i++) { scanf("%d",&arr[i]); } reversearr(arr,0,n-1); for(int i=0;i<n;i++) { printf("%d ",arr[i]); } return 0;}