11C-Practical 07 Finding Quadratic Equation roots
Algoirthim
Input
1)a 2)b 3)c
Output
1) d 2)r1 3)r2
Method:
1. start
2. Read a, b and c
3. Print a, b and c
4. d=b*b-4*a*c
5. Print d
6. if(d==0)
print roots are equal
r1= -b/(2*a)
r2=r1
print r1 and r2
else
if(d>0)
print roots are distinct and real
r1 = -b+ sqrt(d)/(2*a)
r2 = -b - sqrt(d)/(2*a)
print r1 and r2
else
print roots are imaginary
7.stop
No comments:
Post a Comment