Program:
#include< stdio.h >
#include< conio.h >
void main( )
{
int a[ 5 ], i;
for( i = 1; i < 5; i++)
{
printf("\nEnter the value for [ %d ]: ",i);
scanf("%d", &a[ i ]);
}
printf("\nThe array of elements in reverse order:\n");
for(i=5;i>0;i--)
{
printf("%d\t", a[ i ]);
}
}
Output:
Enter the value for [ 0 ]: 0
Enter the value for [ 1 ]: 2
Enter the value for [ 2 ]: 1
Enter the value for [ 3 ]: 9
Enter the value for [ 4 ]: 7
The array of elements in reverse order:
7 9 1 2 0
0 comments:
Post a Comment