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

Can u please help?.........................
Determine which two numbers come next in the sequence 5,5,10,15,25, __, __
7.3 significant figure
A line passes through the point (-10,1) and has a slope of 3/2. Write an equation in point-slope form for this line. Please Help Best helped will get brainiest
if y varies jointly as x and the inverse of z and y = -5 and x = -5 and z = 6, find y when x = 5 and z = -8
using factorization A= 5k²-7x² ​
brainliest also free pts
A beautyberry is a type of shrub that grows well in the southern United States. Some students have a small beautyberry shrub that is growing near their school.
I just got ghosted by my very special friend. We actually became friends 3 days ago. I miss him. What should I do?​
pleasee helpp !! <33