Computer Science, asked by dev2058, 4 months ago

ax^2+bx+c give the java expression​

Answers

Answered by Oreki
2

\textsf{\large Given Expression}

    ax^2 + bx + c

\textsf{\large Java Expression}

    \texttt{a * x * x + b * x + c;}

Answered by BrainlyProgrammer
13

Correct Question:-

  • Write the Java Expression for: ax^2+bx+c

Answer:-

This can be done in two ways:-

  1. a*(Math.pow(x,2))+ (b * x) +c
  2. a * (x * x)+(b*x) + c

_

Note:-

  • Math.pow() returns double data type value
  • It returns a number raised to power other number. Example:  \bold {n}^{2}
  • You can also write Math.pow(x,2) as x * x [As given in Point 2 of the answer]
  • To return the output in integer data type you can use type casting. Example: (int)(Math.pow(x,2))
Similar questions