Step 1 : Start
Step 2 : Read a,b,c //the quadratic equation of the form aX^2 + bX +c
Step 3 : d = b*b - 4*a*c
Step 4 : if d = 0 then go to Step 5
if d > 0 then go to Step 7
if d < 0 then go to Step 10
Step 5 : r1 = r2 = - b / (2 * a)
Step 6 : print 'roots are equal and roots are r1,r2' , go to Step 15
Step 7 : r1 = ( -b + sqrt(d) )/(2 * a)
Step 8 : r2 = ( -b - sqrt(d) )/(2 * a)
Step 9 : print r1,print r2 go to Step 15
Step 10 : x = -b / (2 * a)
Step 11 : y = sqrt ( abs (a)) / (2 * a)
Step 12 : r1= x + iy
Step 13 : r2 = x - iy
Step 14 : print r1,r2
Step 15 : Stop
No comments:
Post a Comment