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

expand the polynomial: -4m^2(n^2-m^2)+3n^2(m^2-n^2)
please help me with this question please arrange this it's music​
which statement about this figure is true?
Determine the number of solutions for the system of equations Y=16x-19 Y=3x^2+4x-7
Complete the sentence with the best verb. ____ my house or yours seem like the best spot to host the meeting? Is it Do or Does?
Take a moment to analyze this work: What is MOST LIKELY the type of shape or form of this work? A. organic shape B. organic form C. geometric shape D. geome
Only certain sports rely on a special set of muscles. A. True B. FalseI will report u if you put fake answer
who's Issac Newton ? ​
Which of the following numbers is not a perfect square? A 44 B 121 C 400 D 625
Attached is a picture of weapon stats of an assault rifle in COD Vanguard. How is time to kill calculated? Keeping in mind target distance and bullet velocity.