140k views
3 votes
Given that a function receives three parameters a, b, c, of type double, write some code, to be included as part of the function, that determines whether the value of "b squared" – 4ac is negative. If negative, the code prints out the message "no real solutions" and returns from the function.

1 Answer

6 votes

Final answer:

To determine if the value of "b squared" - 4ac is negative, substitute the given values of a, b, and c and perform the calculations.

Step-by-step explanation:

To determine whether the value of "b squared" - 4ac is negative, we can substitute the given values of a, b, and c into the expression and perform the calculations.

For example, using the values a = 1.00, b = 10.0, and c = -200, we have:

b squared - 4ac = 10.0 squared - 4 * 1.00 * -200 = 100 - (-800) = 900

Since the result is positive (900 is not negative), there are real solutions to the quadratic equation.

User Shaun Wilde
by
6.0k points