+ 1
Why 6.0 and not 6?
Why is (4 + 8) / 2 6.0 instead of 6?
5 ответов
+ 6
It depends on programming language. In python the division outputs a float number whether it's operands are integer or float.
+ 3
Most probably is Python 3. You should use
int((4 + 8) / 2)
+ 2
Explicit conversion will make your life easier.
+ 1
Because the output of this operation is double, not a int
+ 1
In C, the result is actually 6.