Wrong Answer shown on editor

Continuing the discussion from Ake as input a two-d array. Wave print it column-wise

#include<stdio.h>
void main() {
int n, a[10][10], m;
scanf("%d %d", &m, &n);
for(int i=0; i<m; i++){
for(int j=0; j<n; j++)
scanf("%d", &a[i][j]);
}

for(int i=0; i<m; i++){
	if(i % 2 == 0){
		for(int j=0; j<n; j++){
			printf("%d", a[j][i]);
			printf(", ");
		}
	} 
	else if(i % 2 != 0) {
		for(int j=n-1; j>=0; j--){
			printf("%d", a[j][i]);
			printf(", ");
		}
	}
}
printf("END");

}