Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reversing an Array #752

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Arrays/Array_reversal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include<stdio.h>
#define N 1000

int main(){
int arr[N];

//giving the size of an array
int n;
printf("enter the size of array:\n");
scanf("%d", &n);

// Printing the array that will be reversed
printf("Enter the array:\n");
for(int i=0; i<n; i++){
scanf("%d", &arr[i]);
}

// printing the reversed array
printf("eversed array:\n");
for(int i=n-1; i>=0; i--){
printf("%d ", arr[i]);
}
return 0;


}