im trying to write a code that i can input a,b,c and the code will run it in the quadratic formula and give me the answer but i keep getting a error problem

import math
from math import sqrt

print ("Welcome to the Quadratic Program")
print ("--------------------------------")

a=input("Enter a: ")
b=input("Enter b: ")
c=input("Enter c: ")


if answer<0:
print ("negative")
print answer

I think you use python 3?
In python 3 input() return a string.
And formula will not work.
You can try this,and use code-tag also post error message(Traceback)

import cmath

print("Welcome to the Quadratic Program")

a = int(input("Enter a: "))
b = int(input("Enter b: "))
c = int(input("Enter c: "))

answer = (-b + cmath.sqrt(b ** 2 - 4 * a * c)) / 2

thank you, the code works great,
i have another question, the answer is printed in (-.05+0j) format, is there a way for the program to print just the answer without the j ?

**Nevermind i got it, i changed from "cmath" to "math", thanks for everything

This question has already been answered. Start a new discussion instead.