Question
c programming and cannot use In algebra, one can find the roots of any quadratic polynomial equation ax2 +bx+c = 0 by using the quadratic
c programming and cannot use
In algebra, one can find the roots of any quadratic polynomial equation ax2 +bx+c = 0 by using the quadratic equation, The term under the square root sign (b2 -4ac) is known as the discriminant of the polynomial. The discriminant can tell you if the polynomial has real or imaginary roots, if it is positive or negative, respectively. Write a function solve(int a, int b, int c) which gets the values of a, b and c coefficients and use this information to determine if the polynomial has real or imaginary roots. If the discriminant reveals that the roots are real, find the roots as well. Hint: Remember that the square root function, sqrt(), is located in the math.h library. Use this function in a program that asks the user to enter the values of a, b and c accordingly and displays the information as described above (by calling the function solve). Program execution sample1: Please enter the value of the coefficient a: 1 Please enter the value of the coefficient b: -3 Please enter the value of the coefficient c: 2 The polynomial has real roots. The roots are 2 and 1. Program execution sample2: Please enter the value of the coefficient a: 1 Please enter the value of the coefficient b: 0 Please enter the value of the coefficient c: 3 The polynomial has imaginary roots. NOTE: The header of your function MUST be: void solve(int a, int b, int c)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started