Computer Science, asked by sishmeet491, 1 month ago

write a python program to find all roots of a quadratic equation​

Answers

Answered by Saarthak15Sharma
1

Answer:

Explanation:

The standard form of a quadratic equation is:

Enter a: 1

Enter b: 5

Enter c: 6

The solutions are (-3+0j) and (-2+0j)

Answered by PreetiGupta2006
14

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 .

Attachments:
Similar questions