The code its working, but it can't be validate by the last condition (The displayed result should match the task conditions for any input data.) I dont understand where is the problem. i just notice that if you start with -1, the result is NaN. I dont know what this mean actually.