why all the testcases are failing
#include
using namespace std;
int main(){
int arr[100][100],m,n;
cin>>m>>n;
for(int row=0;row<n;row++){
for(int col=0;col<m;col++){
cin>>arr[row][col];
}
}
for(int row=0;row<n;row++){
if(row%2==0){
for(int col=0;col<m;col++){
cout<<arr[row][col]<<",";
}
}
else{
for(int col=m-1;col>=0;col–){
cout<<arr[row][col]<<",";
}
}
}
cout<<“END”;
}
Wave print row wise
Hey @dips123deepali_c25f140838182212 your code is correct but indexing is wrong you have taken m first so number of rows will be m. Your test case output is correct because of equal number of row and column.
https://ide.codingblocks.com/s/632908 check out this code if you find any difficulty in understanding the code anywhere please ask.
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.