Online Compiler C

#include <stdio.h> int main() { int N = 10; int A[10]; for (int i = 0; i < N; i++) { scanf("%d", &A[i]); } for (int i = 0; i < N / 2; i++) { int temp = A[i]; A[i] = A[N - 1 - i]; A[N - 1 - i] = temp; } for (int i = 0; i < N; i++) { printf("%d", A[i]); return 0; } }
This code reads 10 integers into an array, reverses the array in place, and then prints the reversed array. However, there is a problem in the printing loop that causes the program to exit early.

- The `return 0;` statement is placed inside the last `for` loop, so the loop only runs once and the program ends after printing just the first element of the reversed array. Move the `return 0;` outside the loop, after the closing brace of the loop.