QUESTION IMAGE
Question
what will the following program print when run? var numberone = 5; var numbertwo = 10; if (numberone == 5) { println(1); } if (numberone > 5) { println(2); } if (numbertwo < 5) { println(3); } if (numberone < numbertwo) { println(4); } if (numberone != numbertwo) { println(5); }
Step1: Check first condition
numberOne is 5. numberOne == 5 is true. So println(1) is executed.
Step2: Check second condition
numberOne is 5. numberOne > 5 is false. So println(2) is not executed.
Step3: Check third condition
numberTwo is 10. numberTwo < 5 is false. So println(3) is not executed.
Step4: Check fourth condition
numberOne is 5, numberTwo is 10. numberOne < numberTwo is true. So println(4) is executed.
Step5: Check fifth condition
numberOne is 5, numberTwo is 10. numberOne != numberTwo is true. So println(5) is executed.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
1
4
5