ICSE Class 10 Computer Applications Question 19 of 30

Solved 2024 Question Paper ICSE Class 10 Computer Applications — Question 24

Back to all questions
24
Question

Question 2(iv)

Give the output of the following program segment. How many times is the loop executed?

for(x=10; x>20;x++)

System.out.println(x);

System.out.println(x*2);
Answer
Output
20

The loop executes 0 times because the loop condition x>20 is false as value of x is 10.