Since you can only print horizontally, you have to flip your printing loops. Print each row before you go to the next. That means your outer loop should count rows, not columns.
Now, you may wonder how to know the length of the outer loop, if you don't know which column you are going to print. There are two solutions: either you iterate over the length of the longest column, and if a column is shorter than that length, it just prints whitespace, or you transpose your entire matrix, so it's now a[row][column].