Is there a way to end the code without a new line after a repeat commnad that contains a new line inside it?

The asnwer was trivial, the point is to present the output in an acceptable way for a testing machine, meaning there had to be no space after the end of every new line in order for the test to be passed. I had some troube understanding the logic behind it but eventually after some searching, some help from above and a day of trial and error i figured it out.

for (i = 0; i < row; ++i)
    {
        for (j = 0; j < column; ++j)
        {
            printf(j == column -1  ? "%d" : "%d ", result[i][j]);
            if (i != row -1 && j == column -1)
                printf("\n");
        }
    }

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top