blahblah7956 blahblah7956
  • 06-01-2021
  • Computers and Technology
contestada

Rewrite the following condition to avoid a possible arithmetic exception:

if (Math.sqrt(x) < 3 && x > 7)

Respuesta :

IfeanyiEze8899 IfeanyiEze8899
  • 06-01-2021

Answer:

if (x > 7 && Math.sqrt(x) < 3)

Explanation:

The previous condition checks if the square root of x is less than 3, but this would raise an error if x is a value equal to or less than 0.

So, the condition checks for the value of x before evaluating the square root after the AND operation to prevent an arithmetic exception.

Answer Link

Otras preguntas

Use the distributive property to expand the expression. −(3a3 − 4b2) (12x − 9y − 5)
For a given value of net force, which of the following would increase acceleration for a system? a. increase the mass b. decrease the mass c. increase both forc
Help in 5 6 and then I will help you
How did the 15 republics of the union soviet socialist republics differ from each other
the mass of a textbook is about 1.55 kilograms. About how many pounds is this
Choose as many answers as apply. which of the following actions can be accomplished with electronic banking? view your account status transfer funds pay bills w
is a repeating .3 a real number?
Which would the phrase "the difference between a number and 5" look like as a variable expression?
Which ordered pair will be the coordinates of one of the new vertices?
Which is the line shown in the figure? line XY line XZ line WX line WZ