+ 6

Why 15/4 = 3?

it must be 4

2nd Mar 2017, 7:05 AM
Ali .AP
Ali .AP - avatar
7 Answers
+ 17
15/4 returns integer value 3 and has a remainder of 3.
2nd Mar 2017, 7:07 AM
Hatsy Rei
Hatsy Rei - avatar
+ 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.
2nd Mar 2017, 7:13 AM
Tamra
Tamra - avatar
+ 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
2nd Mar 2017, 5:36 PM
Yash Raghava
Yash Raghava - avatar
+ 3
thanks a lot
2nd Mar 2017, 5:48 PM
Ali .AP
Ali .AP - avatar
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
4th Mar 2017, 5:01 PM
kiran kumar
kiran kumar - avatar
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
9th Mar 2017, 9:52 PM
Ileka Innocent
Ileka Innocent - avatar
0
3
18th Mar 2017, 1:12 AM
Vikram Kumar Singh
Vikram Kumar Singh - avatar