my code
https://ide.codingblocks.com/s/42882
question link
https://online.codingblocks.com/player/11915/content/4825?s=1502
what’s the problem with my code
Arrays-wave print column wise doubt
#include
using namespace std;
//Compiler version g++ 6.3.0
int main()
{
int a[1000][1000]={0};
int m,n;
cin>>m>>n;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>a[i][j];}
}
for(int j=0;j<n;j++){
if(j%2==0){
for(int i=0;i<m;i++){
cout<<a[i][j]<<", ";
}}
else{
for(int i=m-1;i>=0;i--){
cout<<a[i][j]<<", ";
}
}
}
cout<<"END";
}
#include
using namespace std;
int main()
{
int a[100][100];
int n,m;cin>>m>>n;
int val=10;
for(int row=0;row<m;row++)
{
for(int co=0;co<n;co++)
{
val++;
a[row][co]=val;
cout<<a[row][co]<<" ";
}
cout<<endl;
val=val+10-n;
}
for(int co=0;co<n;co++)
{
if(co%2==0)
{
for(int row=0;row<n;row++)
{
cout<<a[row][co]<<","<<" ";
}
}
else
{
for(int row=m-1;row>=0;row--)
{
cout<<a[row][co]<<","<<" ";
}
}
}cout <<"END";
}