Quadratic equation

Report a typo

You are given real numbers a, b and c, where a ≠ 0.

Solve the quadratic equation ax2+bx+c=0 ax^2 + bx + c = 0 and output all of its roots.

It is guaranteed that the equation always has two roots.

Output the results roots in ascending order. Do not round or format them, the testing system does it automatically.

Sample Input 1:

1
-1
-2

Sample Output 1:

-1 2

Sample Input 2:

1
-7.5
3

Sample Output 2:

0.423966 7.07603

Sample Input 3:

0.1
-2
0.999

Sample Output 3:

0.51264 19.4874

Sample Input 4:

-11
-32
41

Sample Output 4:

-3.87177 0.962679
Write a program in Java 17
class Main {
public static void main(String[] args) {
// put your code here
}
}
___

Create a free account to access the full topic