Question: Write a program to the quadratic equation. We know that in quadratic formula: if ax^2 + bx + c = 0, then x1 = [-b

Write a program to the quadratic equation. We know that in quadratic formula:

if ax^2 + bx + c = 0,

then x1 = [-b + sqrt(b^2 - 4ac)] / 2a

and x2 = [-b - sqrt(b^2 - 4ac)] / 2a

The program asks the user to enter coefficients a, b, and c, then solve for and display x1 and x2.

Don't forget to check if coefficient a is zero, then x1 = x2 = -(c / b).

Include math.h to use the sqrt() function.

This program is for the c language.

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!