C program to accept 10 elements in an array and display in reverse order

Example#1

#include<stdio.h>
int main()
{
	int n,i,a[30];
	printf("Enter the size of array:");
	scanf("%d",&n);
	printf("\nEnter the array elements:");
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	printf("\nArray elements are:");
	for(i=0;i<n;i++)
	{
		printf("%d ",a[i]);
	}
	printf("\nArray elements in reverse order:");
	for(i=n-1;i>=0;i--)
	{
		printf("%d ",a[i]);
	}
	return 0;
}

Output:

Facebook Comments

Back to Top