赞
踩
#coding=utf8
import math
a=int(input("请输入a:"));
b=int(input("请输入b:"));
c=int(input("请输入c:"));
drt=b*b-4*a*c;
if a==0:
if b!=0:
print("x=%0.2f"%(-c/b));
else:
print("无根");
else:
if drt==0:
print("x1=x2=%0.2f"%(-b/2/a));
else:
if drt>0:
x1=-b+math.sprt(drt)/2/a;
x2=-b-math.sprt(drt)/2/a;
print("x1=%0.2f"%x1);
print("x2=%0.2f"%x2);
else:
print("虚根");
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。