+ 6
Why 15/4 = 3?
it must be 4
7 Antworten
+ 17
15/4 returns integer value 3 and has a remainder of 3.
+ 14
Since both numbers are whole numbers, / does integer division.
15 ÷ 4 is 3.75, but since it's integer division, the 0.75 is cut off, and you're left with 3. It never rounds up, it just truncates it.
+ 5
Always remember int/int=int....so 15/4=3 it is a kind of a floor function and returns lower integer value
however float/int=float.....so15.0/4=3.75
+ 3
thanks a lot
0
it's 3 because / function is quotient function it shows only the value by which it can be divided at Max time u can divide 15 Max 3times
0
in java when u divide an int by another int , the result would be an int value, eg 4/2=2, if the int however has a remainder eg 5/2, the answer will still be 2 bcos we r dealing with ints, if however we want to get the remainder of the value, we use the DOUBLE instead of int
0
3