Ask 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 and that the math module has been imported.

+3
Answers (1)
  1. 17 April, 22:12
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers