Created
October 31, 2022 17:24
-
-
Save anisur3036/1f4ea0613c2733274629c7c574de1634 to your computer and use it in GitHub Desktop.
Print a reverse order of an array in C language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
*Write a C program to take one positive integer N, the size of an array as input. | |
*Then take an integer array of size N as input and show output in reverse order. | |
*/ | |
#include <stdio.h> | |
int main() { | |
int i, N; | |
scanf("%d", &N); | |
int arr[N]; | |
for(i=0; i<N; i++) { | |
scanf("%d", &arr[i]); | |
} | |
for(i=(N-1); i>=0; i--) { | |
printf("%d", arr[i]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment