C
C#3y ago
Bujju

✅ Incorrect math

(3 / 4) * 100 returns 0, when it should return 75. Why is this?
4 Replies
Jimmacle
Jimmacle3y ago
you're using integers, they can only represent whole numbers 3/4 is 0 you need to make at least one number a floating point number to coerce the rest into being floating point like (3 / 4f) * 100
Auger
Auger3y ago
Or for additional precision, cast one of the numbers into a double.
Bujju
BujjuOP3y ago
Thanks
Accord
Accord3y ago
Closed!

Did you find this page helpful?