ICSE Class 9 Computer Applications
Question 3 of 17
Conditional Constructs in Java — Question 3
Back to all questions 3
Question Question 3
Format the following if statements with indentation:
i. if (x == y) if (x == z) x = 1; else y = 1; else z = 1;
if (x == y)
if (x == z)
x = 1;
else
y = 1;
else
z = 1;ii. if (x == y) {if (y == z) x = 1; y = 2; } else z = 1;
if (x == y)
{
if (y == z)
x = 1;
y = 2;
}
else
z = 1;iii. if (num1 != num2) {
if (num2 >= num3) x = 1; y = 2; }
else {x = 1; if (num1 == num2) z = 3;}
if (num1 != num2)
{
if (num2 >= num3)
x = 1;
y = 2;
}
else
{
x = 1;
if (num1 == num2)
z = 3;
}