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

It's best to start at a higher level when participating in competitive sports. Please select the best answer from the choices provided. T F
use the graph of the polynomial function to find the factored form of the related polynomial. Assume it has no constant
Every day, I wake up at 6 a.m. sharp. After I take a shower and wolf down some breakfast, I hurry out to catch the train downtown_____ I get to the office, I
what are consumers? and what do they do?
I really need help !!!! It’s due by 1:30
Simplify the expression. (−3v) to the power of 5
Use the distributive property to simplify the expression 8(5x-9)
Please help! Which of these are the reason trade increased during the Middle Ages. Select ALL that aply. 1. Food became plentiful. 2. Craftspeople made more af
what kind of changes in science and economics made European exploration possible
Fill in the blank about some of the powers of congress