What is the result of the following code snippet?
int k = 10;
do {
System.out.print(k + " ");
k -= 2;
} while (k > 0);
do {
System.out.print(k + " ");
k -= 2;
} while (k > 0);
A. 10 8 6 4
B. 2 4 6 8 10
C. 10 8 6 4 2
D. 1 3 5 7 9
Answer: Option C
Related Questions on Flow Control
What is the purpose of the "if" statement in Java?
A. To execute a block of code conditionally
B. To create loops
C. To declare variables
D. To define methods
A. No output
B. Error
C. Hello
D. 5
Join The Discussion