C PROGRAM TO PRINT THE ELEMENTS OF ARRAY IN REVERSE ORDER
C PROGRAM TO PRINT THE ELEMENTS OF ARRAY IN REVERSE ORDER
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#include<stdio.h> #define MAX 25 //maximum size of array is 25 main() { int i,n,arr[MAX]; printf(" *** C PROGRAMS BLOG ***"); printf("n >>> Program to Print the element of array in Reverse Order<<<"); printf("nn Enter the size of array: "); scanf("%d",&n); //taking size of array as input from user printf("n Enter the %d elements of array: n",n); //taking input all the elements of array using for loop for(i=0;i<n;i++) { printf("n arr[%d]:",i+1); scanf("%d",&arr[i]); } printf("n The Elements of Array in Reverse order are : n"); //Printing the elements of array in reverse order for(i=n-1;i>=0;i--) { printf(" %d ",arr[i]); } getch(); } |
Sample Output :