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

The stage of the cell cycle where the cell is not actively dividing is called
the seperation of powers was created in constitution to prevent ?
Ow is the constant max_length declared inside a method with the value of 99.98?
If a cell is placed in a hypotonic solution, the net movement of water would be
Kim jong il and fidel castro were 21st century leaders who believed in the idea s of
We call a number special if every digit in the number either is a 1 or borders a 1. For example, 11111, 13, 141, 1441, 515151, and 101 are all special, but 100
Which of the following is not a mineral? A. Coal B. Gold C. Natural diamond D. Solid ice
can someone help me with physics
An organized way to gather information is called
Product of prime factors for 60 = 2x2x3x5 How do i write this in index form? I have tried by simplifying so it is 2 to the power of 2 x 3 x 5 It stills says it