What is the value of variable z after the following code exe
What is the value of variable z after the following code executes ? int x = 10; int y = 20; int z = 0; if (x>3) { z = 4; if (y < 12) { z = 5; } else if (y <= 20) { z = 7; } } else if (x > 5 && y <10) { if (z < 1 || !(y > 3 || x - y < 5)) z = 8; else z = 12; }
Solution
if x>3 is true
Now z=4
If y<12 is false
If y<=20 is true
So z=7

