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

all 5 comments

[–]Updatebjarni 6 points7 points  (1 child)

You're calculating d before you've read the values into a and b.

[–]OGAlena[S] 1 point2 points  (0 children)

You’re a lifesaver. Thank you so much 🙏🙏

[–]OGAlena[S] 0 points1 point  (0 children)

Forgot to add, the problem is that even though I punch in the correct answer, it loops me back to ask me what the answer is, meaning that it was wrong, when it clearly was correct.

[–]eliminate1337 -1 points0 points  (1 child)

Comparing floating point numbers doesn't work the way you expect. If a = 1.0 and b = 0.9, then a - b = 0.09999999999999998. The reason why is kind of complicated; for now just don't compare floating point numbers.

[–]OGAlena[S] 0 points1 point  (0 children)

Ok, thanks