Learn C ProgrammingLearn ProgrammingPrograms On ArraysResources

067. Write a program to accept a number n from user and then accept n array elements from user and reprint them in reverse order of inputs in C language

By September 18, 2012 September 18th, 2019 No Comments
#include<stdio.h>
#include<conio.h> 
main()
{
 int n,i,a[20];
 clrscr();
 printf("Enter number...");
 scanf("%d",&n);
 printf("Enter array elements :\n" );
 for(i=0;i<n;i++)
	{
		printf("Enter element %d : ",i+1);
		scanf("%d",&a[i]);
	}
 for(i=n-1;i>=0;i--)
		printf("\nElement %d : %d",i+1,a[i]);
 getch();
}

Leave a Reply

DEMO01