This is Discussion thread about Arrays-Wave print Column Wise
Discussion About Arrays-Wave print Column Wise
#include
using namespace std;
int main()
{
int ar[100][100],i,m,n,j,c=0;
cin>>m>>n;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
cin>>ar[i][j];
}
for(j=0;j<m;j++)
{
if(c==0)
i=0;
else
i=m-1;
for(;i>=0&i<n;)
{
cout<<ar[i][j]<<", ";
if(c==0)
i++;
else
i–;
}
c=!c;
}
cout<<"END";
return 0;
}
code is giving correct output but test cases not passing
please help anyone