Question: Module 5: Prog 1 . For a given quadratic equation (ax'+bx+c=0). We know that there are two possible roots. The roots may be: real, real
Module 5: Prog 1 . For a given quadratic equation (ax'+bx+c=0). We know that there are two possible roots. The roots may be: real, real but equal, and complex. x-4x + 4 = 0 has real equal roots : x=2 and x=2 x?- 4x + 7 =0 has complex roots: x=2+i1.732 and x=2-i-1.732 x-5-x-14 = 0 has real roots x=7 and x=2 We determine the root type for a given quadratic formula by look at the discriminant, where discriminant-b-4ac If discriminant 0, then the roots are non-equal and real Write an m-file that uses fprintf to print description of the problem for user, and then asks a user for the coefficients a, b, and c from a quadratic equation. Then, use conditional statements to determine the discriminant and decide the type of roots. Calculate the roots, but don't use Matlab function roots. Use fprintf statements to tell the user the root type and then tell the user what the roots are
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
