#include
using namespace std;
int main()
{int a[10][10];
// cout<<“Enter the no of rows:”;
int r;
cin>>r;
cout<<endl;
// cout<<“Enter the no of columns:”;
int c;
cin>>c;
cout<<endl;
////Taking all the inputs from the user
if(r<=10 &&c<=10)
{
for(int i=0;i<c;i++)
{
for(int k=0;k<r;k++)
{
cin>>a[i][k];
}
}
////Printing the output in the form of a wave
for(int k=0;k<c;k++)
{
if(k%2==0)
{
for(int i=0;i<r;i++)
{
cout<<a[i][k]<<", ";
}
}
else
{
for(int i=r-1;i>=0;i--)
{
cout<<a[i][k]<<", ";
}
}
}
cout<<“END”;
}}