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

The combined forces acting on an object make up the ___ force
CAN SOMEONE HELP ME I WILL GIVE BRAINLIEST!38. TRUE OR FALSE: Any amount of CO2 (Carbon Dioxide) in theatmosphere is bad for our planet.○ TRUE○FALSE​
which equation represent the line that passes through the point(-3.4,8.3) and has a slope of 6.5
If AC = x + 3 and DB = 3x – 19, find AC.
________are particles in the nucleus of an atom that have no charge.
Simplify: please and ty
Both __________-__________, __________-__________ and __________-__________, __________-__________ methods of inventory valuation are assumptions as to the flow
Is dis pic gud I've been working on my photography ​
Banners at the store were on sale for $3 off the regular price. Billy bought 4 banners on sale and paid a total of $20. Write an equation to determine the regul
Subtract eleven from twice my age x and it is the same as 34.