The equation ax²+bx + c in problem F1 has 6 cases,that can occur with various va
ID: 3618978 • Letter: T
Question
The equation ax²+bx + c in problem F1 has 6 cases,that can occur with various values for a, b, and c. The 6 casesare:
1) When a, b, and c are all zero, anyx is a solution. Print that message.
2) When a and b are zero and c is not,no solution exists. Print that message.
3) When a is zero and b is not zero,the only solution is x = -c/b.
If it is not one of the first threecases, then it is one of the remaining cases.
The remaining three cases aredetermined by the value of the determinant expressionb2-4ac.
4) When b2-4ac is zero, the only solution is x =-b/2a.
5) When b2-4ac is positive, two solutions aregiven as follow:
6) When b2-4ac is negative, the solutions have areal and an imaginary component, as shown in the followingmathematical equations:
The real component is
xR= -b/2a
The imaginary component is
Aftercomputing the real and imaginary components, print the values ofxRand xIinthe following format.
Printthe text shown here, but with the numeric values substituted forxR andxI
The two solutions are
X1 = xR+i xIand X2 = xR-i xI
where i is the square root of-1.
Forexample, if your results were 98.765 for xRand 0.123 for xI,your program should print:
The two solutions are
X1 = 98.765+ i 0.123and X2 =98.765- i0.123
where i is the square root of -1.
Explanation / Answer
please rate - thanks #include #include #include int main() {double a,b,c; double discriminant,denom; printf("For the equation ax^2+bx+c: "); printf("Enter a: "); scanf("%lf",&a); printf("Enter b: "); scanf("%lf",&b); printf("Enter c: "); scanf("%lf",&c); discriminant=pow(b,2.)-4*a*c; denom=2.*a; printf("The roots of %f x^2+%f x+%f are: ",a,b,c); if(a==0&&b==0&&c==0) printf("any x is a solution "); else if(a==0&&b==0&&c!=0) printf("no x is a solution "); else if(a==0&&b!=0) printf("%f ",-c/b); else if(discriminant==0) printf("%f ",-b/(2*a)); else if(discriminantRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.