Works fine. Don’t know why is it showing error
Here is my code tell me where is the problem
#include<bits/stdc++.h>
using namespace std;
int main()
{
int m,n;
cin >> m >> n;
int a[m][n];
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin >> a[i][j];
}
}
int i,j=0,wave=1;
while(j<n)
{
if(wave == 1)
{
for(i=0;i<m;i++)
{
cout << a[i][j] << ",";
}
j++;
wave=0;
}
else
{
for(i=m-1;i>=0;i--)
{
cout << a[i][j] << ",";
}
j++;
wave=1;
}
}
cout << "END";
return 0;
}
