Reverse the array without using another array

C program to reverse the array without using another array.

Program

#include<stdio.h>
#include<conio.h>
#define MAX 50

void main()
{
	int arr[MAX];
    int i, n, temp;

    printf("Enter the number of elements in the array\t:");
    scanf("%d",&n);
    printf("Enter the elements\n");
    for(i=0;i<n;i++)
    {
        printf("Element %d\t:",i+1);
        scanf("%d",&arr[i]);
    }

    for(i=0;i<n/2;i++)
    {
        temp = arr[i];
        arr[i] = arr[n-i-1];
        arr[n-i-1] = temp;
    }

    printf("\nElements of the reversed array are\n");
    for(i=0;i<n;i++)
    {
        printf("Element %d\t:%d\n",i+1,arr[i]);
    }

    getch();
}

Output

Enter the number of elements in the array       :6
Enter the elements
Element 1       :1
Element 2       :2
Element 3       :3
Element 4       :4
Element 5       :5
Element 6       :6

Elements of the reversed array are
Element 1       :6
Element 2       :5
Element 3       :4
Element 4       :3
Element 5       :2
Element 6       :1