# Program to compute the roots of a quadratic equation # (user enters coefficients) # Matt Bishop, Apr. 9, 2009 # for ECS 10 Spring 2009 import math # load up the math functions def main(): # read in the coefficients a, b, c = input("Enter coefficents (a,b,c) separated by commas: "); # get the first root r1 = (-b + math.sqrt(b**2 - 4*a*c)) / (2*a); # get the second root r2 = (-b - math.sqrt(b**2 - 4*a*c)) / (2*a); # print them out print "The roots are", r1, "and", r2; main()