function solve1(a, b, c : real) : real
if b ** 2 - 4 * a * c >= 0 then
result (-b + sqrt(b ** 2 - 4 * a * c))/(2*a)
else
put "There are no real roots. Giving -9999 as the result"
result -9999
end if
end solve1
if solve1(1, 2, -8) not= -9999 then
put "x**2 + 2x - 8 = 0 has ", solve1(1, 2, -8), " as a root"
end if
if solve1(1, 2, 4) not= -9999 then
put "x**2 + 2x + 4 = 0 has ", solve1(1, 2, 4), " as a root"
end if
|