1036.Bhaskara's Formula in python
This is the solution of this problem:
import math
a,b,c=input().split()
a = float(a)
b = float(b)
c = float(c)
d = float(b*b)-(4*a*c)
if(a!=0):
d = (b*b)-(4*a*c)
if(d>0):
x1 = (-b+math.sqrt(d))/(2*a)
x2 = (-b-math.sqrt(d))/(2*a)
print("R1 = %.5f"%x1)
print("R2 = %.5f"%x2)
else:
print("Impossivel calcular")
else:
print("Impossivel calcular")
No comments