I have pictures below. Please could you explain what I've done wrong?
Your code is a little flawed. Did you trace it? Consider the case when n=1. When if reaches the loop, i=0. It will go to the test condition i < n-1, which will basically check if 0 < 0, because 1-1 is 0. This will evaluate to false and the control won't enter the loop, your code will exit. Hence the error says "Expected output not exit code of 0". This means that it expected some output on the terminal but instead your code just exited. This logic causes the other cases to fail as well.
Also, these are not the only cases for which your code fails, check50 checks with just these cases. Otherwise I think your code will fail for all cases. Try running the code separately using make and ./mario and see what output you get. Don't check your answer directly with check50.
Learning to trace your code and reading error messages will be very useful. Work a little with your code. It can be corrected. :)
n
is 1, 2, and 3? Do you think that should really happen? If not, how to fix it?