← all problems

largerRoot 🌶️🌶️

Write a method that takes the three coefficients of a quadratic equation, a, b, and c (representing ax^2 + bx + c = 0), and returns the larger of its two real roots, using the quadratic formula: (-b + sqrt(b^2 - 4ac)) / (2*a). Precondition: You can assume the equation always has two distinct real roots, and that a is never zero. Use Math.sqrt and Math.pow from the Math class.