Compiler shows only one answer

Coding Blocks compiler correct answer but code block shows output as 1. Why?

Try using return 0, rest code seems fine. You may also check for C++ compiler version.