Wave Print Column wise: Output not getting correctly displayed when No. of rows != No. of columns

Here’s a link to the code: https://ide.codingblocks.com/s/234052

Note: When I tried to print the indexes of the elements(commented part in line no. 24 and 29), it gave the correct indexes as required. However, when I’m trying to print the array elements using the same indexes, it is giving won’t output and also printing garbage values. However, it is giving the correct output when No. of rows and no. of columns are equal. Kindly check and tell me what’s wrong…

there is a problem in the logic

refer to this code

1 Like