carriganlee1375 carriganlee1375
  • 25-01-2021
  • Computers and Technology
contestada

What is the output of the following code snippet? int s1 = 20; if (s1 <= 20) { System.out.print("1"); } if (s1 <= 40) { System.out.print("2"); } if (s1 <= 20) { System.out.print("3"); }

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 25-01-2021

Answer:

The program outputs 123

Explanation:

The first line of the program initializes s1 to 20

The second line checks if s1 is less than or equal to 20.

This is true,

So, 1 is printed

The third line checks if s1 is less than or equal to 40.

This is true,

So, 2 is printed

The fourth line checks if s1 is less than or equal to 20.

This is true,

So, 3 is printed

Hence, the output is 123

Answer Link

Otras preguntas

A Rankine power generation cycle operates with steam as the working fluid. The turbine produces 100 MW of power using 89 kg/s of steam entering at 700C and 5MPa
A plumbers plastic pipe is 4 m long, has an inside diameter of 4.0 cm and an outside diameter of 5.0cm. What is the volume of the plastic in the pipe?
The owner of a collection of old anvils lent it to the local museum and hired professional movers to transport the anvils to the second floor of the museum, whe
f(x) = 275 1. Find the inverse of f(x) and its domain.
What is the solution to -4(8-3x)>6x-8? O x > -4/3 O x < -4/3 O x > 4 O x < 4
Sort each phrase to the country it best describes?
i need some help with this question. it says find x
please please please answer!! will give brainliest and extra points!
Read the following excerpt from Leslie Marmon Silko’s story "The Man to Send Rain Clouds." They turned off the highway onto the sandy pueblo road. Not long afte
ASAP PLSSS!!!!!!!!!!1!!!!!!!!!!!!!!!!!!!!!!!!!!!