Algorithm for display roots of a quadratic equation #c

1. Read the value of a , b , c
2. d = b*b - 4*a*c
3. if d < 0 then display The Roots are Imaginary.
           else if d = 0
                     then dispaly Roots are Equal.
                                       r = -b / 2*a
                                       display r

                 else r1 = -b + √d / 2*a
                        r2 = -b - √d / 2*a

                    display Roots are real and r1 , r2

4. Stop

Comments

Popular posts from this blog

Algorithm to display "n" natural numbers #c

Algorithm to display the sum of n natural numbers #c

Algorithm for Sum of two numbers