Question: A quadratic equation can have either one or two distinct real or complex roots depending upon nature of discriminant of the equation. Where discriminant
A quadratic equation can have either one or two distinct real or complex roots depending upon nature of discriminant of the equation. Where discriminant of the quadratic equation is given by A = b-4ac Depending upon the nature of the discriminant, formula for finding roots can be given as: Case 1: If discriminant is positive (flag=1). Then there are two real distinct roots given by. -b+ -b-A and 2a 2a Case 2: If discriminant is zero (flag=0). Then it have exactly one real root given by. b 2a Case 3: If discriminant is negative (flag=-1). Then it will have two distinct complex roots given by. -b -b +i and i 2a 2a 2a 2a Based on the value of flag of determinant, write a complete C program using switch statement to determine and print out the roots of the polynomial. [7 marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
