(Solved):Write a test program that prompts the user to enter values for a, b, and c and displays the result based on the discriminant. If the discriminant is positive, display two roots. If the discriminant… View Answer…

 

Question

Write a test program that prompts the user to enter values for a, b, and c and displays the result based on the discriminant. If the discriminant is positive, display two roots. If the discriminant 0, display the one root. Otherwise, display “The equation has no roots”.

Example:

Enter a, b, c: 1.0 3 1

The equation has two roots: – 0.381966 and – 2.61803

Enter a, b, c: 1 2.0 1

The equation

Scroll to top