Question: Write a program that will solve any quadratic function with real roots using the quadratic formula: Ax 2 + Bx + C = 0, root1=
- Write a program that will solve any quadratic function with real roots using the quadratic formula:
Ax2 + Bx + C = 0, root1= (-B-sqrt(B*B 4*A*C))/(2*A), root2 = (-B+sqrt(B*B 4*A*C))/(2*A)
The user will be allowed to solve as many quadratic equations as possible. Use a while loop menu; the user is prompted to enter A, B, C until the user is ready to quit. Note the following:
- A!=0. If this is violated, display Ax2 + Bx + C = 0, is not quadratic
- B*B-4*A*C>=0. If this is violated, display Ax2 + Bx + C = 0, does not have real roots
If the two conditions are satisfied, calculate and display the roots.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
