a=float(input("Ingrese el coeficiente a: "))
b=float(input("Ingrese el coeficiente b: "))
c=float(input("Ingrese el coeficiente c: "))
if a==0:
    print("Sin solución")
else:
    d=(b**2)-(4*a*c)
    print("El discriminante es: ", d)
    if d>0:
        X1=(-b+d**(1/2))/(2*a)
        X2=(-b-d**(1/2))/(2*a)
        print("La primera raíz es: ", X1)
        print("La segunda raíz es: ", X2) 
    else:
        if d<0:
           PR=-b/(2*a)
           PI=((-d)**(1/2))/2*a
           print("X1= ", PR, "+", PI, "i")
           print("X2= ", PR, "-", PI, "i")
        else:
           X1=-b/(2*a)
           print("La única solución es: ", X1)

        

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: