2D Array problem

#include
using namespace std;
int main()
{int n ,m;
cin>>m>>n;
int arr[n][m];
if((m>=1 && m<=10)&&((n>=1 && n<=10)))
{
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin>>arr[i][j];
}
}
for(int j=0;j<n;j=j+1)
{
if(j%2==0)
{
for(int i=0;i<m;i++)
{
cout<<arr[i][j]<<",";
}
}
else
{
for(int i=m-1;i>=0;i–)
{
cout<<arr[i][j]<<",";
}
}
}
}
cout<<“END”;
}

I tried to print the 2 d array to print in wave form

But what is wrong in it in above code?

i tried to submit but still i get failed.

Please advise…

#include using namespace std; int main() { int n ,m=0; cin>>m>>n; int arr[n][m]; if((m>=1 && m<=10)&&((n>=1 && n<=10))) { for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { cin>>arr[i][j]; } } for(int j=0;j<n;j=j+1) { if(j%2==0) { for(int i=0;i<m;i++) { cout<<arr[i][j]<<", “; } } else { for(int i=m-1;i>=0;i–) { cout<<arr[i][j]<<”, "; } } } } cout<<“END”; }

@chellapandiyan hey please check the output format as there is problem in that,also I have more optimized it and made it cleaner please check:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.