# Python Program to Solve Quadratic equation

Python Program to Solve Quadratic equation

In this program, you will learn how to calculate the roots of a square equation when the coefficients a, b and c are known.

The quadratic formula uses "a", "b" and "c" from

where "a", "b" and "c" are just numbers; They are the "numerical modules" of the square equation they have given you to solve.

To understand the following program, you must have the knowledge to follow Python concepts:

For quadratic formula: for

the values of x which are the solutions of the equation are given as:

**Python Code:**

`import cmath`

a = float(input('enter value of a:'))

b = float(input('enter value of b:'))

c = float(input('enter value of c:'))

def h(x):

a*x**2+b*x+c

return h(x)

disc = b**2-4*a*c

root1 = (-b+cmath.sqrt(disc))/2*a

root2 = (-b+cmath.sqrt(disc))/2*a

print(root1,root2)

**Output:**

```
enter value of a: 49
enter value of b: 9
enter value of c: 36
(-220.5+2046.153403340033j) (-220.5+2046.153403340033j)
```

**Recommended Post:**Program to check whether the number is prime

Plotting of even, odd, prime numbers

Subplot of even, odd and prime numbers from a list

Python Program to print Arithmetic Progress series

Program to find even and odd numbers from the list

Program to check whether a number is odd or even in Python