Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The solution of the equation ax2 + bx + c has 6 cases, that can occur with vario

ID: 3668881 • Letter: T

Question

The solution of the equation ax2 + bx + c has 6 cases, that can occur with various values of a, b, and c. Test for these 6 cases in the order given here. Do not compute any values until you have determined what calculations are needed. The 6 cases are: When a, b, and c are all zero, any value of x is a solution. Print: Any value of x is a solution. When a and b are zero and c is not, no solution exists. Print: No solution exists. When a is zero and b is not zero, the only solution is x = -c/b. Calculate the value of x and print the solution. The remaining three cases are determined by the value of the determinant. The determinant is b2 - 4ac. Compute and save the value of the dererminant now. You can use the value of the determinant you saved to select one of the remaining three cases. When the determinant is zero, the only solution is x = -b/2a. Calculate the value of x and print the solution. When the determinant is positive, two solutions are given by the following two expressions: x1 = ( -b + b2 - 4ac ) / 2a x2 = ( -b - b2 - 4ac ) / 2a Print both solutions. When the determinant is negative, the solutions have an imaginary component. Print: The solutions have an imaginary component. If you are fimiliar with imaginary numbers, you may compute and print the result, but this is not required. Test it 7 times: a = 0 b = 0 c = 0 a = 0 b = 0 c = 4 a = 0 b = 8 c = -12 a = 2 b = 4 c = 2 a = 2 b = 2 c = 0 a = 100 b=100 c= -11 a = 1 b = 1 c = 1 Check your results by hand, by substituting your results back into the equation and verify that they are roots.

Explanation / Answer

#include<stdio.h>
#include<conio.h>
#include<math.h>

int main()
{
float a,b,c,alf,bt,dlt;
clrscr();

printf(" Enter a: ");
scanf("%f",&a);

printf(" Enter b: ");
scanf("%f",&b);

printf(" Enter c: ");
scanf("%f",&c);

dlt=b*b-4*a*c;

if(a==0&&b==0)
{
printf(" NO SOLUTION EXIST");
}

if(a==0&&b!=0)
{
printf("root=%d"-c/b);
}

if(dlt==0)
{
printf(" ALPHA=BETA=%f",-b/(2*a));
}
elseif(dlt<0)
{
printf(" Imaginary Roots");
}
else
{
alf=(-b+sqrt(dlt))/(2*a);
bt=(-b-sqrt(dlt))/(2*a);
printf(" Alpha = %f Beta=%f ",alf,bt);
}

getch();
return 0;
}