Answers for "Algorithm for Roots of the quadratic equation ax2 + bx + c = 0"

0

Algorithm for Roots of the quadratic equation ax2 + bx + c = 0

Step 1: Start
Step 2: Declare variables a, b, c, D, x1, x2, rp and ip;
Step 3: Calculate discriminant
         D ← b2-4ac
Step 4: If D ≥ 0
              r1 ← (-b+√D)/2a
              r2 ← (-b-√D)/2a 
              Display r1 and r2 as roots.
        Else     
              Calculate real part and imaginary part
              rp ← -b/2a
              ip ← √(-D)/2a
              Display rp+j(ip) and rp-j(ip) as roots
Step 5: Stop
Posted by: Guest on May-22-2021

Code answers related to "Algorithm for Roots of the quadratic equation ax2 + bx + c = 0"

Browse Popular Code Answers by Language