Question on Hacker Rank to print row wise.
Link to complete question: https://hack.codingblocks.com/practice/p/369/216
My Solution :
#include
using namespace std;
int main()
{
int arr[10][10];
int row=0;
int col=0;
cin>>row>>col;
for(int i=0;i<row;i++)
{
for(int j=0;j<col;j++)
{
cin>>arr[i][j];
}
}
for(int i=0;i<row;i++)
{
if(i%2==0)
{
for(int j=0;j<col;j++)
cout<<arr[i][j]<<", ";
}
else
{
for(int j=row-1;j>=0;j--)
{
cout<<arr[i][j]<<", ";
}
}
}
cout<<“END”;
return 0;
}
Link to code : http://tpcg.io/9yxYL8
None of the test cases are passing, please can you help and tell me the mistake.