Integer Division and Type Promotion
What is printed when the following code segment is executed?
int a = 5;
int b = 2;
double c = 3.0;
System.out.println(5 + a / b * c - 1);
A
10.0
B
11.5
C
9.0
D
0.666666666666667
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | songqiuhui2012 | 1 | 1 | 0m 05s | 95 |
| #2 | 7017046 | 1 | 1 | 0m 26s | 74 |
| #3 | leftoverjluck | 1 | 1 | 0m 40s | 60 |
| #4 | patrickmeijer009 | 1 | 1 | 0m 42s | 58 |
| #5 | kazvin.tjakradinata | 1 | 1 | 0m 44s | 56 |
| #6 | y.seong2027 | 1 | 1 | 1m 11s | 29 |
| #7 | isaact.taylor52 | 1 | 1 | 1m 16s | 24 |
| #8 | ngvandangthanh | 0 | 1 | 0m 00s | -10 |
| #9 | parth.taur227 | 1 | 2 | 2m 46s | -76 |
| #10 | 108185265 | 1 | 1 | 3m 47s | -127 |
Items per page:
10
1 – 10 of 14
APFIVE