#include<stdio.h>
int main()
{
int a[' '], b[ ' '], i,j,size;
printf ("enter size of array:");
scanf("%d",&size);
for (i = 0; i < size; i++)
{printf ("Enter value in array:");
scanf("%d",&a[i]);}
for (i = size -1, j = 0; i >= 0; i--, j++)
b[j] = a[i];
printf("\nThe array is");
for (i = 0; i < size; i++)
printf(" %2d",a[i]);
printf("\nThe reversed array is");
for (i = 0; i < size; i++)
printf(" %2d", b[i]);
///printf("%4d\t\t-->%4d\n", b[i]);
return 0;
}
Comments