#include <stdio.h>
#include<conio.h>
int main()
{
int n, i, j, a[10], b[10];
clrscr();
printf(“Enter the number of elements in array\n”);
scanf(“%d”, &n);
printf(“Enter the elements\n”);
for (i = 0; i < n ; i++)
{ scanf(“%d”, &a[i]);}
//copy the elemnents in another array in reverse way
for (i = n – 1, j = 0; i >= 0; i–, j++)
b[j] = a[i];
//Copying reversed array into original.
for (i = 0;i < n;i++)
a[i] = b[i];
printf(“Reverse array is\n”);
for (i= 0; i< n; i++)
printf(“%d\n”, a[i]);
getch();
return 0;
}
c program to reverse an array
#include<conio.h>
int main()
{
int n, i, j, a[10], b[10];
clrscr();
printf(“Enter the number of elements in array\n”);
scanf(“%d”, &n);
printf(“Enter the elements\n”);
for (i = 0; i < n ; i++)
{ scanf(“%d”, &a[i]);}
//copy the elemnents in another array in reverse way
for (i = n – 1, j = 0; i >= 0; i–, j++)
b[j] = a[i];
//Copying reversed array into original.
for (i = 0;i < n;i++)
a[i] = b[i];
printf(“Reverse array is\n”);
for (i= 0; i< n; i++)
printf(“%d\n”, a[i]);
getch();
return 0;
}