| 2 | |
| 3 | |
| 4 | int main(){ |
| 5 | int n,aux; |
| 6 | |
| 7 | scanf("%d",&n); |
| 8 | int array[n]; |
| 9 | int last = n-1; |
| 10 | |
| 11 | /*Reading the n numbers typed by the user*/ |
| 12 | for(int i = 0 ; i < n; i++){ |
| 13 | scanf("%d",&array[i]); |
| 14 | } |
| 15 | |
| 16 | /* |
| 17 | Scrolling through the array of read numbers and changing the position elements using an auxiliary variable |
| 18 | to store the current position value. Then the values are shifted. the first value goes to the last position |
| 19 | and the last value goes to the first position. The same logic applies to the following positions. |
| 20 | */ |
| 21 | for(int i = 0 ; i < n/2; i++){ |
| 22 | aux = array[i] ; |
| 23 | array[i]=array[last]; |
| 24 | array[last]=aux; |
| 25 | last--; |
| 26 | } |
| 27 | |
| 28 | /*Displaying the array that was inverted*/ |
| 29 | for(int i = 0 ; i < n; i++){ |
| 30 | printf("%d ",array[i]); |
| 31 | } |
| 32 | printf("\n"); |
| 33 | |
| 34 | |
| 35 | } |
nothing calls this directly
no outgoing calls
no test coverage detected