Computer Applications

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);

Java Iterative Stmts

ICSE 2024

6 Likes

Answer

Output
20

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

Answered By

6 Likes


Related Questions