Skip to content

Latest commit

 

History

History
11 lines (6 loc) · 770 Bytes

File metadata and controls

11 lines (6 loc) · 770 Bytes

Quadratic Equation

Implement the function FindRoots to find the roots of the quadratic equation: ax2 + bx + c = 0. The function should return a tuple containing roots in any order. If the equation has only one solution, the function should return that solution as both elements of the tuple. The equation will always have at least one solution.

The roots of the quadratic equation can be found with the following formula:

image

For example, FindRoots(2, 10, 8) should return (-1, -4) or (-4, -1) as the roots of the equation 2x^2^ + 10x + 8 = 0 are -1 and -4.

Try it yourself!