C
C#2y ago
Bujju

✅ Incorrect math

(3 / 4) * 100 returns 0, when it should return 75. Why is this?
4 Replies
Jimmacle
Jimmacle2y 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
Auger2y ago
Or for additional precision, cast one of the numbers into a double.
Bujju
BujjuOP2y ago
Thanks
Accord
Accord2y ago
Closed!
Want results from more Discord servers?
Add your server