Wrong test case

#include
int main() {
return 0;
}#include<bits/stdc++.h>
#include
using namespace std;
int main()
{
int i, j;
int rows, cols;
cin>>rows>>cols;
int a[rows][cols];
while ((rows > 1 && rows < 10 ) && (cols > 1 && cols <10))
{
for (i= 0 ; i <rows ; i++)
{
for(j =0 ; j <cols ; j++)
{
cin>>a[i][j];
}
}
for (i= 0 ; i <rows ; i++)
{
if (i % 2 == 0)
{
for(j =0 ; j <cols ; j++)
{
cout<<a[j][i]<<", “;
}
}
else
{
for(j =cols-1 ; j >=0 ; j–)
{
cout<<a[j][i]<<”, ";
}

        }	
    }
    
    cout<<"END";
    return 0;
}

}

Hello @dhruvtrehan45,

Always share your code using Online Coding Blocks IDE.
The way you have shared it has introduced many syntax errors to it.
STEPS:

  1. Paste it on https://ide.codingblocks.com/
  2. Save it there.
  3. Share the URL generated.

Now, coming back to your code:

  1. Please, review your code before sharing it:
    #include
    int main() {
    return 0;
    }#include<bits/stdc++.h>
    #include
    using namespace std;

  2. Your code is failing for the test cases like:
    4 3
    11 12 13
    21 22 23
    31 32 33
    41 42 43
    Expected Output:
    11, 21, 31, 41, 42, 32, 22, 12, 13, 23, 33, 43, END
    Your Output:
    11, 21, 31, 32, 22, 12, 13, 23, 33, 41, 31, 21, END

Correct it.
Let me know if you face any difficulty.

Hope, this would help.

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.