Question: Rewrite the if logic in the code below as one nested if statement. int x = scan.nextInt(); int y; if (x == 10) y

Rewrite the if logic in the code below as one nested if

Rewrite the if logic in the code below as one nested if statement. int x = scan.nextInt(); int y; if (x == 10) y = 5; if (x == 20) y = 6; if (x!= 10 && x != 20) y = 7;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the nested if ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!