Question: For a quadratic equation ax2+bx+c = 0 (where a, b and c are coefficients), it's roots is given by the formula:- The value of the

For a quadratic equation ax2+bx+c = 0 (where a, b and c are coefficients), it's roots is given by the formula:-

The value of the discriminant (b2-4ac) determines the nature of roots. Write a C++ program that reads the values of a, b and c from the user and performs the following:-

a. If the value of the discriminant is positive, program should print out that the equation has two real roots and prints the values of the two roots.

b. If the discriminant is equal to 0, the roots are real and equal.

c. if the value of the discriminant is negative, then the equation has two complex roots.

Sample Output

Enter values for a, b and c:- 2 10 3 Discriminant = 76

Equation has two real roots Roots are as follows:- x1 = -0.320551 x1 = -0.320551

Any character to end:-

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!