0

How does 1.5 < (7/4) equal 0? I dont understand

It was in a coding challenge in C++

26th Sep 2020, 11:38 PM
Odnantiev
Odnantiev - avatar
2 Answers
+ 3
would be helpful to post the whole code im assuming its integer math so its basically 1.5 < 1 which is false which has a Boolean value of 0.
26th Sep 2020, 11:48 PM
Roderick Davis
Roderick Davis - avatar
+ 1
Yes, integer/integer gives integer result unless you typecast at least one of the operands to float, or explicitely work with float variables.
26th Sep 2020, 11:58 PM
arturop200
arturop200 - avatar