Quadratic equation in Falcon
Example for versions
Falcon 0.9.6.6
a = int(input())
if a == 0
printl("Not a quadratic equation.")
exit()
end
b = int(input())
c = int(input())
d = b ** 2 - 4 * a * c
if d == 0
printl("x = " + (-b / 2.0 / a))
else
if d > 0
printl("x1 = " + ((-b + d**0.5) / 2.0 / a))
printl("x2 = " + ((-b - d**0.5) / 2.0 / a))
else
printl("x1 = (" + (-b / 2.0 / a) + "," + ((-d)**0.5 / 2.0 / a) + ")")
printl("x2 = (" + (-b / 2.0 / a) + "," + (- ((-d)**0.5 / 2.0 / a)) + ")")
end
end
Comments
]]>blog comments powered by Disqus
]]>