Ask Question
26 April, 03:58

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.

+2
Answers (1)
  1. 26 April, 06:44
    0
    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);

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “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 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers