Doubt

#include
using namespace std;

int main() {
int a[100];
int n;
cin>>n;
for(int k = 0;k>n;k++){
cin>>a[k];
}
int i = 0 ;
int j = n - 1;
while(i<j){
int start = a[i];
int end = a[j];
swap(start,end);
i++;
j–;
}
for(int k =0;k>n;k++){
cout<<a[k]<<endl;
}

return 0;

}

Hello @discobot,
The logic is correct but when you are taking input as well as giving output of the array elements, k will less then n starting from 0 so it will be:
for(int k = 0;k<n;k++){
cin>>a[k];
}
for(int k =0;k<n;k++){
cout<<a[k]<<endl;
}

Hi! To find out what I can do, say @discobot display help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.