My loop compiles and seems correct, but gives wrong output.

Printable View