0

You got something wrong!

Under the java lesson, basic concepts, in primitive operators, the third question says that 15/4 = 3. I just tried random numbers until I got it, but it was kinda annoying

22nd Aug 2019, 12:29 AM
Paul Canfield
Paul Canfield - avatar
2 Answers
+ 7
That is correct. 15 divided by 4 yields 3 with a remainder of 3. 15/4 is a integer division, so the remainder is ignored. You can actually look at the lesson comments for explanations after getting that right.
22nd Aug 2019, 12:31 AM
Hatsy Rei
Hatsy Rei - avatar
+ 1
15/4=3.75 but integer storing only non decimal parts of result. int i = 15 / 4; // 3 double d = 15.0 / 4.0; // 3.75 System.out.println(i); System.out.println(d);
22nd Aug 2019, 1:32 AM
zemiak