Showing failed testcases

#include
using namespace std;
int main() {
int m,n,i,j,a[10][10];
cin>>m>>n;
for(i=0;i<m;i++)
{for(j=0;j<n;j++)
cin>>a[i][j];
}
for(i=0;i<m;i++)
{for(j=0;j<n;j++)
cout<<a[j][i]<<",";
}
cout<<“END”;
return 0;
}

Approach you are using in your code is wrong, You need to check, if the value of column is odd or even…print accordingly based on tht value only…
for(int j=1;j<=m;j++)
{
if(j%2!=0)
{
for(int i=1;i<=n;i++)
cout<<arr[i][j]<<", “;
}
else
{
for(int i=n;i>0;i–)
cout<<arr[i][j]<<”, ";
}
}

#include using namespace std; int main() { int m,n,i,j,a[10][10]; cin>>m>>n; for(i=0;i<m;i++) {for(j=0;j<n;j++) cin>>a[i][j]; } for(j=0;j<n;j++) { if(j%2==0) {for(i=0;i<m;i++) cout<<a[i][j]<<","; } else {for(i=m-1;i>=0;i–) cout<<a[i][j]<<","; } } cout<<“END”; return 0; }

??plz tell…

hi anshul
yes you got the right approach
and for sharing code
first save it to online ide of coding block save it and then post the save link here
it help us to debug more fast
happy coding

check now…

in line 14 i-- u have written i-

int line 16 cout<<“END”

in line 18 have use different set of inverted commas

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.