KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Write the output of the following program code:

char ch ;
int x=97;
do
{
    ch=(char)x;
    System.out.print(ch + " " );
    if(x%10 == 0)
    break;
    ++x;
} while(x<=100);

Java

Java Iterative Stmts

ICSE 2015

52 Likes

Answer

The output of the above code is:

a b c d

Working

The below table shows the dry run of the program:

xchOutputRemarks
97aa1st Iteration
98ba b2nd Iteration
99ca b c3rd Iteration
100da b c d4th Iteration — As x%10 becomes true, break statement is executed and exists the loop.

Answered By

24 Likes