There was an error in this gadget

## A Quadratic Equation Solver - The Algorithm

The problem Write a program to calculate the roots of a quadratic equation of the form:

The roots are given by the following formula

The algorithm

1. READ values of a, b and c,
2. if a is zero then stop as we do not have a quadratic,
3. calculate value of discriminant
4. if D is zero then there is one root: ,
5. if D is > 0 then there are two real roots: and ,
6. if D is < 0 there are two complex roots: and ,
7. PRINT solution.

## ALGORITHM TO SOLVE QUADRATIC EQUATION1.integer a,b,c;2.float d,r1,r2,r3,r4,r;3.print ‘Enter values of a,b,c of a quadratic equation:’;4.read a,b,c;5.value of a,b,c is transferred to function ‘quad’and body of function is:6.d b x b-4 x a x c;7.if(d<0)8.print ‘Value of Discriminant is negative’;9.else10.if(d=0)11.print ‘Roots are real’12.r=-b/2*a;13.print ‘First and Second root of equation:’,r;14.else15.r1 -b+sqrt(d);16.r2 2*a;17.r r1/r2;18.r3 -b-sqrt(d);19.r4 r3/r2;20.print ‘First root of equation: ’, r;21.print ‘Second root of equation: ’, r4;

1. This comment has been removed by the author.

2. Jazzakum Allahu Khairan
Really like your courage to have this Blog

3. @Taofeek, thanks

4. So sweet of ur profile and the program(very helpful)......

5. I am from India

6. thks for ur help it did me alot of gud

7. You are welcome bro, more will be updated soon

8. This comment has been removed by the author.