Computer Science, asked by gaurv9161, 8 months ago

−±√2−4/2 Write in java Expression???

Answers

Answered by Oreki
6

\textsf{\large \textbf{Given Expression}}

   x = \dfrac{-b \: {\displaystyle \pm } \: \sqrt{b^2 - 4ac}}{2a}

\textsf{\large \textbf{Java Expression}}

   \texttt{x\_one = (-b + Math.sqrt(b * b + 4 * a * c)) / 2 * a;}\\\texttt{x\_two = (-b - Math.sqrt(b * b + 4 * a * c)) / 2 * a;}\\\textsf{\hspace{2em}or,}\\\texttt{double[] x = \{ (-b + Math.sqrt(b * b + 4 * a * c)) / 2 * a,}\\\texttt{ \hspace{7em}(-b - Math.sqrt(b * b + 4 * a * c)) / 2 * a \:\} }

Similar questions