Be careful with casting to an integer here. If the user had input a float like 2.2, then it would return 4 as the answer, which isn't the right answer.