+ 2
Why this result??
double a=888/100*17; System.out.println(a); output is 136.0 Can anyone explain the result???
2 Respuestas
+ 2
I got it....Thank you very much....
+ 1
888, 100 and 17 are all ints.
888/100 is 8 (decimals get cut off), 8*17 is 136.
This gets converted to a double and stored.
To get the proper result, change one of the numbers to a double literal, for example:
double a = 888.0/100+7;