For example, when entering the number 13, it gives the answer 3.0
Answer 1, Authority 100%
Because B
– int
and 4 too int
Row Double C = b / 4;
works like this:
double c = (double) (b / 4);
first occurs integer division, and then bringing to double
;
To the division was not integer Write:
double c = b / 4.0;
In this case, b
will be Double
everything will be correct.