Roots of Quadratic Equation using User define Function - Python3
from math import sqrt
def roots(a,b,c):
root1, root2 = (-b+(sqrt(pow(b,2)-(4*a*c))))/2*a, (-b-(sqrt(pow(b,2)-(4*a*c))))/2*a
return root1,root2
a = float(input('Enter a: '))
b = float(input('Enter b: '))
c = float(input('Enter c: '))
print("Roots of eq: ",roots(a,b,c))
ScreenShot:
No comments:
Post a Comment