“Display Elements of Array in Reverse Order” is a C language program. It inputs an array of 5 integer elements. It displays array elements in reverse order on screen. That is, it will show element with last index = 4 first of all.
The source code for C program to input array of 5 integer numbers and then display all elements of array in reverse order is as follows:
/* Write a C Program to input 5 numbers in array of five integers. Display all values (elements) in reverse order from array. Show elements from last to first. */ #include<stdio.h> int main() { int numArray[5], i; /*input in array using for loop*/ for(i=0; i<5; i++) { printf("Enter Element No:%d=",i+1); scanf("%d", &numArray[i]); } /* show array elements using for loop */ /* in reverse order */ printf("The elements of array in Reverse order are:\n"); for(i=4;i>=0;i--) printf("%d\n", numArray[i]); return 0; }
This is an image showing sample run and output of the c program to show array elements in reverse order: