Given:
What is the result?
Given:
What is the result?
The given code is a loop structure with a do-while loop containing a for loop inside it. The variable 'i' is initially set to 10. In each iteration of the do-while loop, 'i' is divided by 2, and the resulting value is assigned to 'j'. The for loop prints 'j' until 'j' is greater than 0, decrementing 'j' with each iteration. After the for loop completes, 'i' is decremented by 2. This process continues until 'i' is no longer greater than 0. The sequence of prints will be: 5 4 3 2 1 (when i=10), 4 3 2 1 (when i=8), 3 2 1 (when i=6), 2 1 (when i=4), 1 (when i=2). Hence, the output will be '5 4 3 2 1 4 3 2 1 3 2 1 2 1 1'.
public class Question2 { public static void main(String[] args) { int i = 10; do { for (int j = i / 2; j > 0; j--) { System.out.print(j + " "); } i -= 2; } while (i > 0); } } Resutl: 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 . --> Choose D.
D is correct
Correct Ans is A
✅ D https://onecompiler.com/java/3zkx2jqfm
✅ D https://onecompiler.com/java/3zkx2jqfm
Look for all prints below: i = 10 j = 5 print 5 4 3 2 1 i = 8 j = 4 print 4 3 2 1 i = 6 j = 3 print 3 2 1 i = 4 j = 2 print 2 1 i = 2 j = 1 print 1
D is the correct answer
D is the answer
Answer is D
D is the correct answer
D is the correct answer
D is correct
Correct answer: D
D is correct
D is Correct
D is correct
D is correct