Read three doubles x, y, z from input and print their product in Java.

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

Answer

\(x = scnr.nextDouble(); y = scnr.nextDouble(); z = scnr.nextDouble(); System.out.println(x * y * z);\)

Approach

x = scnr.nextDouble();
y = scnr.nextDouble();
z = scnr.nextDouble();
System.out.println(x y z);

Step-by-step solution

  1. Use the Scanner object scnr to read three double values from input using nextDouble().
  2. Assign these values to the variables x, y, and z.
  3. Output the product of the three variables using System.out.println(x y z);.