Computer Science, asked by gangapoudel315, 5 months ago

Write down java expression for:

√a2 + b2

Answers

Answered by anindyaadhikari13
12

Question:-

Write the Java expression for the following.

Answer:-

Given expression,

 \sf \sqrt{ {a}^{2}  +  {b}^{2} }

The Java expression for the following is,

Math.sqrt(a*a + b*b);

Or,

Math.sqrt(Math.pow(a,2)+Math.pow(b,2));

Better to write Math.sqrt(a*a+b*b) as it takes less time to write.

Math.sqrt() is used to calculate the square root of any positive number.

Answered by Oreki
4

\textsf{\large Given Expression}

    \sqrt{a^2 + b^2}

\textsf{\large Java Expression}

    \texttt{Math.sqrt(a * a + b * b);}

Similar questions