Code does not get correct output

#include
using namespace std;
int main() {
int m;
int n,i,j;
cin>>m;
cin>>n;
int a[m][n];
for(i=0; i<m; i++){
for(j=0; j<n; j++){
cin>>a[i][j];
}
}
for(i=0; i<m; i++){
if(i%2==0){
for(j=0; j<n; j++){
cout<<a[i][j]<<", ";
}
}

else{
	for(j=n-1; j>=0; j--){
		cout<<a[i][j]<<", ";
	}
}
}
cout<<"END";
return 0;

}