Java Reference
In-Depth Information
7.
Last digit:
number % 10
8.
Second-to-last digit:
(number % 100) / 10
or
(number / 10) % 10
Third-to-last digit:
(number % 1000) / 100
or
(number / 100) % 10
9.
first: 19
second: 8
The code swaps the values of the variables
first
and
second
.
10.
int first = 8, second = 19;
first += second;
second = first - second;
first -= second;
11.
a: 6
b: 9
c: 16
12.
46
36
23
13
13.
double y = 34.2 + x * (-4.6 + x * (19.3 + x * (-9.1 + x * 12.3)));
14.
(a)
2 * count
(b)
15 * count - 11
(c)
-10 * count + 40
(d)
4 * count - 11
(e)
-3 * count + 100
15.
for (int i = 1; i <= 6; i++) {
// your code here
System.out.println(18 * i - 22);
}
16.
4
2
17.
24 1
22 2
19 3
15 4
10 5
Search WWH ::
Custom Search