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 the domain and range of 4n/n-5 -2?
53 POINTS!!!!! PLEASE HELP!!!!! (EXPLAIN AS WELL PLEASE!!!!!)
What is one reason historians can rely on government records for accurate historical information? A. because the information presented in government records ha
Select three nonrenewable types of energy. hydroelectric coal wind human/animal nuclear petroleum
A quadratic function, f(x), has one zero at (0, 0) and a maximum value at (1, 1). Is it possible to find the second zero of f(x)? If it is possible, then is it
Which has opposite sides parallel and congruent?
Help me find the GCF. (show work).
Currently, accepted theories DO NOT predict single existing particles having electrical charge equal * a.half elementary charge b.one elementary charge c.two el
Characterization for Nat Field/ King of Shadows
Anaya walks 10 meters in 15 seconds. What is her walking rate in meters per second? *