roszettadean4548 roszettadean4548
  • 04-04-2020
  • Computers and Technology
contestada

1. Write code that prints the square root of the value in the variable num rounded to 4 decimal places. Assume that num already has a value and that the math module has been imported.

Respuesta :

ijeggs
ijeggs ijeggs
  • 06-04-2020

Answer:

System.out.printf("The square root is %.4f\n",sqrt);

Explanation:

In Java programming language using the print format method of System.out One can specify the the number of decimal places. In this case to 4 decimal places.

See a complete code snippet below

public class num1 {

   public static void main(String[] args) {

       double num =5;

       double sqrt = Math.sqrt(5);

       System.out.printf("The square root is $%.4f\n",sqrt);

   }

}

Answer Link

Otras preguntas

What is a federal scout
Mary is making a pinata that has a ball-like shape. The pinata has a surface area of 40 feet. Use the formula for the surface area of a sphere: (S=4πr^2) to fin
You can divide any parallelogram into two matching triangles. How is this useful?i need to know this answer right now please
Well explained answer plz: Can girls with dark black skin bleach there girlstashes? ???
1. What is the empirical formula for a compound containing 63.8% N and 36.2% O? a. N₂O₅ b. N₂O₃ c. NO₂ d. NO e. N2₂O
find the sum of 3b/b+2 and 12/b+2 and express it in simplest form
The radius of a bicycle wheel is 12 in. What is the approximate circumference of the wheel?
what two large alliances took shape before the beginning of world war 1
how do i change a trapezoid into a rectangle
If a pizza costs 2.85 to make and customer pays 8.95 how much profit have I made as a percentage