Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Jsp arithmetic operator division is always equal to 0.
Jsp arithmetic operator division is always equal to 0.
This is the default conversion of numeric types in java.

In your expression, sb is int and sum is int, then the calculation result of 0. 1875 will be automatically converted into int, which is 0.

To get the correct result, you can cast it, such as: double a = (double) (sb/sum);

You can get floating-point data.