Computer Science, asked by pujamahi2326, 6 months ago

Q..What will the output of the following:

int x = 9;
System.out.println(Math.sqrt (x));​

Answers

Answered by akbarshibbi
2

Answer:

output: 3.0

Explanation:

Mathematically if we solve this question i.e., √9, we will get 3 but in java the return type of Math.pow and Math.sqrt is always in double data type. So, we get 3.0. Even if we write int x=9 as given in the question, the output will be in double data type.

Similar questions