//reverse an arrey in c programming
#include "stdio.h"
int main (){
int arr[50];
int n,i;
printf ("enter the number of elements in the arrey :");
scanf ("%i",&n);
printf("enter all elements in the arrey: ");
for (i=0;i<n;i++){
scanf ("%i",&arr[i]);
}
printf ("the arrey with reverse order is like that :");
for (i=n-1;i>=0;i--){
printf ("%i\n",arr[i]);
}
return 0;
}
output output output output output
enter the number of elements in the arrey :6
enter all elements in the arrey: 78
98
90
89
76
56
the arrey with reverse order is like that :56
76
89
90
98
78
No comments:
Post a Comment