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

Evaluate the expression. (9 + 5)(3 + 2)0 A) 0 B) 1 C) 14 D) 15
which is greater 145cnetimeter or 1.5m
As stream velocity decrease, which factor will likely increase? A) erosion of the stream bank B) deposition of material in the stream C) amount of material car
Is it possible to have a triangle such that none of the exterior angles is obtuse? Please help and explain
EMERGENCY!! PLEASE HELP I NEEd IT NOW!!
Graph -3x^2+12y^2=84. what are the domain and range? I already know the domain is all real numbers and the range is {y|y≤-√7 or y≥√7} I just need to find out h
Any really smart people who can answer this? (Questions 14 and 16)
Of what historic importance in Titusville, Pennsylvania?
Please help thank you so much
A washer and dryer cost 715 combined. The washer cost 35 less than the dryer. What is the cost of the dryer?