Compute z = x - sqrt(y) in Java

Check the final answer first, then review the worked steps.

Answer

\(z = x - Math.\sqrt{y};\)

Approach

z = x - Math.sqrt(y);

Step-by-step solution

  1. Use the Math.sqrt() method to calculate the square root of $y$.
  2. Subtract this value from $x$ and assign the result to $z$.
  3. The code line is: z = x - Math.sqrt(y);