question:
wave print column wise(coding blocks question)
answer:
#include
using namespace std;
int main() {
int m;
int n;
int row,col;
cin>>m>>n;
int arr[m][n];
for(row=0;row<=m-1;row++)
{
for(col=0;col<=n-1;col++)
{
cin>>arr[row][col];
}
}
for(col=0;col<=n-1;col++)
{
if(row%2==0)
{
for(row=0;row<=m-1;row++)
{
cout<<arr[row][col]<<",";
}
}
else
{
for(row=m-1;row>=0;row--)
{
cout<<arr[row][col]<<",";
}
}
}
cout<<“END”;
return 0;
}
