My code: https://ide.codingblocks.com/s/654454
Can anyone point out what’s wrong in my code?
consider this input
3 4
1 2 3 4
4 5 6 7
8 9 10 11
Your Code output
1 2 4 8 5 3 4 6 9 0 10 11
Correct output
1 2 4 8 5 3 4 6 9 10 7 11
now try to modify your code
if you need help feel free to ask
I tried to look for my mistake. But i can’t figure it out. Can you Please help me sir?
Sir would you help me out? Or should i just give up?
sorry @ayushkotwar2002_78a27ac2b05189a5
actually i missed your doubt
now i am checking your code and will reply you soon
Alright sir. I’ll wait.
i check your code
if (i % 2 == 0) {
cout << a[p][j] << " ";
}
else {
cout << a[j][p] << " ";
}
this logic will work only if matrix is square matrix
check out this simple code