C program that asks user to input numbers and then reverse the numbers. How I can print the arrays side by side? It prints the arrays below each others now.
#include <stdio.h>
#define N 10
int main(){
int a[N], i;
for(i = 0; i < N; i++){
scanf("%d", &a[i]);
}
for(i = 0; i < N; i++){
printf("%d\n", a[i]);
}
for(i = N - 1; i >= 0; i--){
printf("%d\n", a[i]);
}
return 0;
}
printf("%d %d\n", a[i], a[reverse_index]);
where you need to figure out thereverse_index
(usingi
andN
and some arithmetic).