Python program to find all roots of a quadratic equation
Asked by admin @ in Computer Science viewed by 369 People
Write a python program to find all roots of a quadratic equation
Asked by admin @ in Computer Science viewed by 369 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 363 persons
Asked by admin @ in Math viewed by 305 persons
Asked by admin @ in Math viewed by 302 persons
Asked by admin @ in Mathematics viewed by 356 persons
Asked by admin @ in Math viewed by 310 persons
Asked by maham237 @ in Mathematics viewed by 454 persons
Asked by maham237 @ in Mathematics viewed by 391 persons
Asked by admin @ in Mathematics viewed by 310 persons
Asked by admin @ in Mathematics viewed by 295 persons
Asked by admin @ in Mathematics viewed by 351 persons
Asked by admin @ in Mathematics viewed by 314 persons
Asked by admin @ in Mathematics viewed by 292 persons
Asked by admin @ in Math viewed by 311 persons
Asked by admin @ in Math viewed by 312 persons
Asked by admin @ in Math viewed by 308 persons
Asked by admin @ in Computer Science viewed by 19035 persons
Asked by admin @ in Computer Science viewed by 15823 persons
Asked by admin @ in Computer Science viewed by 10981 persons
Asked by admin @ in Computer Science viewed by 10413 persons
Asked by admin @ in Computer Science viewed by 8150 persons
Asked by admin @ in Computer Science viewed by 7850 persons
Asked by admin @ in Computer Science viewed by 6497 persons
Asked by admin @ in Computer Science viewed by 5801 persons
Asked by admin @ in Computer Science viewed by 5703 persons
Asked by admin @ in Computer Science viewed by 5484 persons
Asked by admin @ in Computer Science viewed by 4991 persons
Asked by admin @ in Computer Science viewed by 4982 persons
Asked by admin @ in Computer Science viewed by 4695 persons
Asked by admin @ in Computer Science viewed by 4496 persons