This is a case of the code not being formatted very well. The last line 'return 0;' is not inside the if/else blocks.
Because the if and the else are not using {}, they are single line...