NZEC Error in C++

The code while compiling gives the correct output but while submitting it gives a Runtime error(SIGSEGV). Please Help.!..

#include
using namespace std;
int main() {
// your code goes here
int n,arr[20],oa[20];
cin>>n;
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<n;i++){
oa[i]=arr[n-i-1];
}
for(int i=0;i<n;i++){
cout<<oa[i]<<" ";
}
return 0;
}

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Also - which Problem are you trying to solve? :slight_smile:

2 Likes

This must be the problem you’re trying to solve

And, there was another thread the other day, it should answer your question.

1 Like

Thank you it actually worked…