Knowee
Questions
Features
Study Tools

Write an algorithm and draw a flowchart thatwill calculate the roots of a quadratic equation Hint: d = sqrt ( ), and the roots are:x1 = (–b + d)/2a and x2 = (–b – d)/2a2 0ax bx c  2 4b ac

Question

Write an algorithm and draw a flowchart thatwill calculate the roots of a quadratic equation Hint: d = sqrt ( ), and the roots are:x1 = (–b + d)/2a and x2 = (–b – d)/2a2 0ax bx c  2 4b ac

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here is the algorithm:

  1. Start
  2. Input the values of a, b, and c
  3. Calculate the discriminant (d) using the formula: d = sqrt(b^2 - 4ac)
  4. If d < 0, print "No real roots"
  5. If d = 0, calculate the root using the formula: x = -b / (2a) and print the root
  6. If d > 0, calculate the roots using the formulas: x1 = (-b + d) / (2a) and x2 = (-b - d) / (2a) and print the roots
  7. End

And here is the flowchart:

Start
  |
  V
Input a, b, c
  |
  V
Calculate d = sqrt(b^2 - 4ac)
  |
  V
d < 0 ?
  |   \
  |    \
 Yes   No
 |      |
 V      V
Print "No real roots"   d = 0 ?
  |                      |   \
  |                      |    \
 End                    Yes   No
                         |     |
                         V     V
Calculate x = -b / (2a)   Calculate x1 = (-b + d) / (2a) and x2 = (-b - d) / (2a)
Print x                   Print x1, x2
  |                         |
  V                         V
 End                       End

This problem has been solved

Similar Questions

Input values of a,b,c for a quadratic equation and find roots of the equation..

Write a C program to find the roots of a Quadratic equation.

The quadratic equation x kx2 2 02 + + = has equal roots, if the value of k is:(a) – 4 (b) 2(c) ± 4 (d) 4

Identify the quadratic equation(s).INSTRUCTIONSYou may select more than one option

Find the positive value of k for which the equations: x2 + kx + 64 = 0 and x2 – 8x+ k = 0 will have real roots:(a) 12(b) 16(c) 18(d) 22

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.