write a program in c to point the elements of an array in reverse order
//write a program in c to point the elements of an array in reverse order
#include <stdio.h>
int main()
{
int n, i;
printf("Enter the size of an array: ");
scanf("%d", &n);
int arr[n];
// to take a input in array
for(i = 0; i < n; i++);
{
printf("Please give value for index %d: ",i);
scanf("%d", &arr[i]);
}
printf("array printing in reverse order is: \n");
//for loop to print array in reverse order
for(i=n-1;i>=0;i--)
{
printf("%d\n",arr[i]);
}
return 0;
}
Comments
Post a Comment