Wave print row wise

#include
using namespace std;
int main() {
int n,m;
cin>>n;
cin>>m;
int arr[n][m];
for(int i=0; i<n; i++){
for( int j=0;j<n;j++){
cin>>arr[i][j];
}
cout<<endl;
}
for(int row=0; row<n; row++){
if(row%2==0){
for(int col=0; col<n;col++){
cout<<arr[row][col]<<’,’<<’ ‘;
}
}
else{
for(int col=n-1; col>=0;col–){
cout<<arr[row][col]<<’,’<<’ ';
}
}
}
return 0;
}
//getting the desired output still test case not successful

hi @srivastavaayush1611_3fd51b257da0b834 updated