int int for k-- System out println System out println int int for 10 S

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
a. int y = 1;
int k;
for(k = 6; k >= 3; k--)
y = y + k;
System.out.println("y = " + y);
System.out.println("k = " + k);
b. int y = 6;
int k;
for(k = 1; k <= 6; k++)
y = y+k;
y = y * 10;
System.out.println("y = " + y);
System.out.println("k = " + k);
c. int y = 2;
int k;
for(k = 7; k <= 2; k++)
y = y + k;
System.out.println("y = " + y);
System.out.println("k = " + k);
d. int y = 0;
int k = 4;
while (k > 1 ){
y = y + 1 / k;
k = k - 1;
}
System.out.println("y = " + y);
System.out.println("k = " + k);
e. int y = 0;
int k = 3;
do {
k = k * 2;
y = y + k;
}
while (k < 7);
System.out.println("y = " + y);
System.out.println("k = " + k);