Uploaded by Okiror Samuel Vinald

Group AP

advertisement
GROUP AP
COMPUTER ASSIGNMENT
Members
Wamala Victor Daniel
Okiror Samuel Vinald
Opio Emmanuel
Mugombe Isaac
Olyel Mark
Reg no.
20/U/6701
20/U/6640/PS
19/U/8390/PS
Pseudocode Code
Standard form ax^2 + bx +c = 0
X = (-b ∓ √(b^2-4ac))/2a
Start
read a,b,c,d and a ≠ 0
input a,b,c
if d > 0, there are two real and different roots
root1, x1 = (-b + √(b^2-4ac))/2a
root2, x2 = (-b - √(b^2-4ac))/2a
print x1, x2
endif
elseif d=0, there are two real equal roots
x1 = x2 = (-b)/2a
print x1, x2
else d<0, here are two different imaginary roots
x1 = (-b)/2a + ( i√(b^2-4ac))/2a
x2 = (-b)/2a - ( i√(b^2-4ac))/2a
print x1, x2
endif
end
Flow chart
Start
read a,b,c,d,
d = b*b – 4*a*c
inputs a,b,c
False
d≥0
True
x1 = (-b)/2a + ( i√(b^2-4ac))/2a
x1, = (-b + √d)/2a
x2 = (-b)/2a - ( i√(b^2-4ac))/2a
x2 = (-b - √d)/2a
Print x1, x2
Print x1, x2
Stop
Download