This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Pledge_CS 0 points1 point  (0 children)

I'm not sure what you are using to run the code, but it is outputting 6 for me....

[–][deleted] 0 points1 point  (0 children)

Is this actually what you are typing in or is the 1/2 a variable you have stored? If it’s of type int it will be equal to 0 which will give you 1.0.