Python program to find all roots of a quadratic equation
Asked by admin @ in Computer Science viewed by 366 People
Write a python program to find all roots of a quadratic equation
Asked by admin @ in Computer Science viewed by 366 People
Write a python program to find all roots of a quadratic equation
Answered by admin @
This program computes roots of quadratic equations when coefficients of a,b and c are known.
The standard form of Quadratic Equation is:
ax² + bx + c = 0 where,
a,b and c are real numbers and a ≠ b
⠀⠀⠀: So let's cöde for this program :
a=int(input("Enter a: "))
b=int(input("Enter b: "))
c=int(input("Enter c: "))
D=(b* *2)-(4*a*c)
print("The value of discriminant is",D)
sol1 = (-b+D* *0.5/2*a)
sol2 = (+b-D* *0.5/2*a)
print("The roots of this quadratic equations are", sol1, "and" ,sol2)
Here first , we need to find the discriminant and then roots.
Note: You can change the values of a ,b and c in the above program to test its output .
Asked by admin @ in Math viewed by 359 persons
Asked by admin @ in Math viewed by 303 persons
Asked by admin @ in Math viewed by 300 persons
Asked by admin @ in Mathematics viewed by 351 persons
Asked by admin @ in Math viewed by 308 persons
Asked by maham237 @ in Mathematics viewed by 450 persons
Asked by maham237 @ in Mathematics viewed by 385 persons
Asked by admin @ in Mathematics viewed by 305 persons
Asked by admin @ in Mathematics viewed by 292 persons
Asked by admin @ in Mathematics viewed by 346 persons
Asked by admin @ in Mathematics viewed by 312 persons
Asked by admin @ in Mathematics viewed by 286 persons
Asked by admin @ in Math viewed by 309 persons
Asked by admin @ in Math viewed by 309 persons
Asked by admin @ in Math viewed by 304 persons
Asked by admin @ in Computer Science viewed by 19030 persons
Asked by admin @ in Computer Science viewed by 15815 persons
Asked by admin @ in Computer Science viewed by 10977 persons
Asked by admin @ in Computer Science viewed by 10407 persons
Asked by admin @ in Computer Science viewed by 8145 persons
Asked by admin @ in Computer Science viewed by 7845 persons
Asked by admin @ in Computer Science viewed by 6492 persons
Asked by admin @ in Computer Science viewed by 5795 persons
Asked by admin @ in Computer Science viewed by 5696 persons
Asked by admin @ in Computer Science viewed by 5479 persons
Asked by admin @ in Computer Science viewed by 4986 persons
Asked by admin @ in Computer Science viewed by 4976 persons
Asked by admin @ in Computer Science viewed by 4688 persons
Asked by admin @ in Computer Science viewed by 4492 persons