C Program to Print Array in Reverse Order

C Program to Print Array in Reverse Order

Write C Program to Print Array in Reverse Order

// C Program to Print Array in Reverse Order

#include <stdio.h>
int main()
{
	int n = 5, A[n], i;

	for(i = 0; i < n; i++)
	{
		printf("Enter A[%d] :--> ", i);
		scanf("%d", &A[i]);
	}
	printf("Reverse Array :--> ");
	for(i = n - 1; i >= 0; i--)
	{
		printf("%d ",A[i]);
	}
	return 0;
}

Output:

Enter A[0] :--> 5
Enter A[1] :--> 4
Enter A[2] :--> 3
Enter A[3] :--> 2
Enter A[4] :--> 1

Reverse Array :--> 1 2 3 4 5