What's new

Help Help po flowchart

Hatdoggs

Eternal Poster
Joined
Nov 21, 2017
Posts
635
Solutions
1
Reaction
147
Points
410
Create a flowchart for this program and
make sure to consider which values of a, b, and c will give no solutions to the
quadratic equation.
 
Last edited:
Here is a flowchart that represents the program you described:

Code:
Start

Input a
Input b
Input c

Calculate discriminant = b^2 - 4ac

If discriminant < 0 Then
    Display "No solution"
Else If discriminant = 0 Then
    Calculate solution = -b / (2a)
    Display "Solution: " + solution
Else
    Calculate solution1 = (-b + sqrt(discriminant)) / (2a)
    Calculate solution2 = (-b - sqrt(discriminant)) / (2a)
    Display "Solutions: " + solution1 + ", " + solution2

End

In this flowchart, the program starts by accepting the values of a, b, and c. It then calculates the discriminant using the formula b^2 - 4ac.

Next, it checks the value of the discriminant. If the discriminant is less than 0, it means there are no real solutions to the quadratic equation. In this case, the program displays "No solution".

If the discriminant is equal to 0, it means there is only one solution to the quadratic equation. The program calculates the solution using the formula -b / (2a) and displays it.

If the discriminant is greater than 0, it means there are two distinct solutions to the quadratic equation. The program calculates both solutions using the formulas (-b + sqrt(discriminant)) / (2a) and (-b - sqrt(discriminant)) / (2a), and then displays them.

Note that the flowchart assumes the use of a square root function (sqrt) to calculate the solutions. Additionally, it does not account for the case where a is equal to 0, as that would not be a quadratic equation.
 

Similar threads

Back
Top