使用Python求解二元一次方程:
a = int(input("请输入整数a"))
b = int(input("请输入整数b"))
c = int(input("请输入整数c"))
if a==0 and b!=0:
num = b/c
print("方程解为:",num)
if a==0 and b==0:
print("方程无解")
if a!=0 and b*b==4*a*c:
num = -b/(2*a)
print("方程解为",num)
if a!=0 and b*b>4*a*c:
num1 = (-b+(b*b-4*a*c)**0.5)/(2*a)
num2 = (-b-(b*b-4*a*c)**0.5)/(2*a)
print("方程有两个解,分别为",num1,num2)