+ 1
Integer division removes any remainder to result as an integer.....i dint understand this line
2 ответов
+ 3
Which language?
If it's C , C++ or Java :
result of integer / integer is always an integer.
for example, 5/2 should be 2.5 but both the operands (5 and 2) are integers so result is also integer. Therefore number 2.5 is truncated to 2 and the result is 2 not 2.5
If either operand is float or double another operand will be promoted to be float or double and then result will be float or double.
for example , 5.0 / 2 results in 2.5 (double value)