KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

Predict the Output of the given snippet, when executed:

int a=1,b=1,m=10,n=5; 
if((a==1)&&(b==0))
{
System.out.println((m+n)); 
System.out.println((m—n));
}
if((a==1)&&(b==1))
{
System.out.println((m*n)); 
System. out.println((m%n));
}

Java

Java Conditional Stmts

ICSE

12 Likes

Answer

50
0

Working

First if condition is false, second if condition is true. Statements inside the code block of second if condition are executed.
m*n => 10 * 5 => 50
m%n => 10 % 5 => 0

Answered By

7 Likes