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
0.666666666666667
B
10.0
C
11.5
D
9.0
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | zhenmunse | 1 | 1 | 0m 01s | 99 |
| #2 | songqiuhui2012 | 1 | 1 | 0m 05s | 95 |
| #3 | Potter16 | 1 | 1 | 0m 19s | 81 |
| #4 | Wilbert.Ankomah27 | 1 | 1 | 0m 19s | 81 |
| #5 | 7017046 | 1 | 1 | 0m 26s | 74 |
| #6 | leftoverjluck | 1 | 1 | 0m 40s | 60 |
| #7 | patrickmeijer009 | 1 | 1 | 0m 42s | 58 |
| #8 | kazvin.tjakradinata | 1 | 1 | 0m 44s | 56 |
| #9 | y.seong2027 | 1 | 1 | 1m 11s | 29 |
| #10 | isaact.taylor52 | 1 | 1 | 1m 16s | 24 |
Items per page:
10
1 – 10 of 18
