Not able to find error

output is fine but wrong on submit and shows test case is wrong

#include
using namespace std;
int main()
{
int M,N;
cin>>M>>N;

if ((M>=1 && M<=10) && (N>=1 && N<=10) )
{

int Array[M][N];

for (int i = 0; i < M; i++)
{
    for (int j = 0; j < N; j++)
    {
        cin>>Array[i][j];
    }
}
for (int col = 0; col < N; col++)
{
    if (col%2==0)
    {
        for (int row = 0; row < M; row++)
        {
            cout<<Array[row][col]<<",";
        }
    }
    else
    {
        for(int row=M-1;row>=0;row--){
            cout<<Array[row][col]<<",";
        }
    }
}  
cout<<"END";
}
return 0;   

}

#include

using namespace std;

int main()

{

int M,N;

cin>>M>>N;

if ((M>=1 && M<=10) && (N>=1 && N<=10) )

{



int Array[M][N];

for (int i = 0; i < M; i++)

{

    for (int j = 0; j < N; j++)

    {

        cin>>Array[i][j];

    }

}

for (int col = 0; col < N; col++)

{

    if (col%2==0)

    {

        for (int row = 0; row < M; row++)

        {

            cout<<Array[row][col]<<",";

        }

    }

    else

    {

        for(int row=M-1;row>=0;row--){

            cout<<Array[row][col]<<",";

        }

    }

}  

cout<<"END";

}

return 0;   

}

hello @rprahulpal03 wait i am checking your code:

hey @rprahulpal03 there was just small error .
you were doing mistake in printing .
i have corrected yout code and now it is passing every test case.


Happy Learning!!

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.