KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Give the output of the snippet:

int a=10,b=12;
if(a==10&&b<=12)
a--;
else
++b;
System.out.println(a + "and" +b);

Java

Java Conditional Stmts

ICSE

44 Likes

Answer

9and12

Working

As a is 10 and b is 12 so the condition of if is true. a is decremented by 1, b remains unchanged.

Answered By

20 Likes