how should i know about specifically which test case i failed?
Test case failed
Please share your code
#include using namespace std; int main() { int arr[10][10]={0}; int M,N; cin>>M>>N; for(int i=0;i<M;i++) { for(int j=0;j<N;j++) { cin>>arr[i][j]; } } int i=0; int j=0; while(j<N) { while(i<M) { cout<<arr[i][j]<<", β; i++; } j++; iβ; while(i>=0) { cout<<arr[i][j]<<β, "; iβ; } j++; i++; } cout<<βENDβ; return 0; }
hey please provide on this https://ide.codingblocks.com/
go here ,paste your code ,Press ctrl+S & share the url link
No need now ,I checked your code
It will fail when columns are odd because in each iteration of outer loop you are printing 2 columns .
So to avoid that add a break statement between inner while loops
This one if(j==N)break;
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.