The roots of the quadratic equation ax2 + bx + c = 0, a ≠ 0 are given by the following formula:
In this formula, the term b2 - 4ac is called the discriminant. If b2 - 4ac = 0, then the equation has a single (repeated) root. If b2 - 4ac > 0, the equation has two real roots. If b2 - 4ac < 0, the equation has two complex roots. Write a program that prompts the user to input the value of a (the coefficient of x2), b (the coefficient of x), and c (the constant term), and outputs the type of roots of the equation. Furthermore, if b2 - 4ac ≥ 0, the program should output the roots of the quadratic equation. (Hint: Use the method pow or sqrt from the class Math to calculate the square root. Chapter 3 explains how to use these methods.)
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.