Question: #include #include #include int main() { float a, b, c, x, x1, x2, i; printf(-------------------------Quadratic Equation Solver------------------------------); printf( Please enter the value of a: );

#include #include #include int main() {

float a, b, c, x, x1, x2, i; printf("-------------------------Quadratic Equation Solver------------------------------"); printf(" Please enter the value of a: "); scanf("%f", &a); printf(" Please enter the value of b: "); scanf("%f", &b); printf(" Please enter the value of c: "); scanf("%f",&c); x1 = (-b/2*a)+i*sqrt(4*a*c-b*b)/2*a; x2 = (-b/2*a)-i*sqrt(4*a*c-b*b)/2*a; x = (-b/2*a); if(b*b-4*a*c<0) { printf(" ---------------------------Complex Roots----------------------------------------"); printf(" x1:%.2f", x1); printf(" x2:%.2f", x2); printf(" -----------------------------------------------------------------------------"); } if(b*b-4*a*c==0) { printf(" ---------------------------Repeated Root-----------------------------------------------"); printf(" x:%.2f", x); printf(" ---------------------------------------------------------------------------------------"); } if(b*b-4*a*c>0) { printf(" ----------------------------Distinct Real Roots------------------------------------"); } return (0);

}

need the code to display the i for the complex roots, and need an equation for distinct real roots. thank you !

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!