Arrays-Wave print column wise

My code at Coding Blocks IDE is failing the last test case. What am I doing wrong?