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

4) Last week, you wrote the C++ program to calculate the 50 T roots of the quadr

ID: 3600909 • Letter: 4

Question

4) Last week, you wrote the C++ program to calculate the 50 T roots of the quadratic equation ax'+bx+c-0 using thoe formula: x1.2- 2a But, if 4ac >b then the value under the square root is negative and the roots are said to be complex. This is so because the curve does not cut the x-axis. Modify your program to calculate the roots only when b 2 4ac. Otherwise, print a message saying that 32 01 2 3 4 the roots are complex. Run your program using the coefficients of the equation represented by the curve on the graph given above.

Explanation / Answer

In your previous program, put code ( which evaluate the formula of quadratic equation) under if-else statement and rest of program as it is

if( b*b >= 4*a*c)

{

Evaluate formula as in previous program( last week)

}

else

{

printf(" the roots are complex ");

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote