Integer and Floating Point Division
What is the output of the following program?
public class DivisionTest {
public static void main(String[] args) {
double x = 7/2;
double y = 7/2.0;
System.out.println(x + " " + y);
}
}
A
3.0 3
B
3 3.5
C
3.0 3.5
D
3 3
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | zgj07310417 | 2 | 2 | 0m 49s | 151 |
| #2 | sailajavadlamani33 | 1 | 1 | 0m 00s | 100 |
| #3 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #4 | lsj08030922 | 1 | 1 | 0m 38s | 62 |
| #5 | richa.tuli | 1 | 1 | 0m 42s | 58 |
| #6 | chunxiangxu.cxu | 1 | 1 | 0m 46s | 54 |
| #7 | bommasam000 | 1 | 2 | 16m 30s | -900 |
Items per page:
10
1 – 7 of 7
APFIVE