Ask Question
27 September, 20:35

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.

+1
Answers (1)
  1. 27 September, 21:35
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers