write a program to calculate and print roots of the quadratic equations =ax^2+ bx+ c(a is not equal to 0)
Answers
Answered by
2
Answer:
hello,
Explanation:
#program to calculate and print roots of the quadratic equations =ax^2+ bx+ c
a=int(input("enter value of x**2"))
b=int(input("enter value of x"))
c=int(input("enter the coefficient "))
d=(b**2)-(4*a)*c
if d==0:
print("real and equal roots")
r1=(-b)+(d**0.5)/(2*a)
r2=(-b)-(d**0.5)/(2*a)
print("roots are",r1,"and",r2)
elif d>0:
print("real roots")
r1=(-b)+(d**0.5)/(2*a)
r2=(-b)-(d**0.5)/(2*a)
print("roots are",r1,"and",r2)
else:
print(" roots are imaginary")
hope it helps you
please mark brainliest
@ItzSnowySecret07
Similar questions