import math a,b,c = eval(input("ing输入方程的系数")) delta = b*b-4*a*c x = -b/(2*a) if delta>0: x1 = x+math.sqrt(delta)/(2*a) x2 = x-math.sqrt(delta)/(2*a) print('{:.2f}'.format(x1),'{:.2f}'.format(x2)) elif delta == 0: x=-b/(2*a) print("方程有唯一解",x) else: print("方程无解")
python一元二次方程求根
最新推荐文章于 2024-03-23 13:43:23 发布