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 do biotic and abiotic factors have in common
which word could be used to describe 4x in the expression 4x+7
A triangle has angles measuring 43.5 and 62.8 1. What is the measure of the triangle's third angle? 2. Classify the triangle by sides and angles
Introduced species are very beneficial to ecosystems when they are brought into them. True or False? I say False
what is 4/5 times 10?
What types of gas molecules typically diffuse and effuse faster?
Napoleon’s rule made Europeans love France and ended any desire they had to rule themselves. It deprived them of a unified code of law. A. True B. False
how many terms are in this expression? 2xy-3x
By 1914, which European nation had the most powerful navy?
can someone explain what's n+1-3n=-5+n+1-2