when input is
3 4
11 12 13 14
21 22 23 24
31 32 33 34
It gives output
11,21,31,32,22,12,13,23,33,34,31,21,END
which is wrong.
sir
give me correction on my code and then ide link plz.
code is here
#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β;
}