# Arup Guha
# 8/27/2018
# Solves a Quadratic with real roots.

import math

# Read in the coefficients to the quadratic.
a = float(input("Please enter a from your quadratic equation.\n"))
b = float(input("Please enter b from your quadratic equation.\n"))
c = float(input("Please enter c from your quadratic equation.\n"))

# Calculate the discriminant.
discriminant = math.pow(b, 2) - 4*a*c

# Real root case.
if discriminant >= 0:

    # Calculate both roots.
    root1 = (-b + math.sqrt(discriminant))/(2*a)
    root2 = (-b - math.sqrt(discriminant))/(2*a)

    # Print out the roots.
    print("The roots of your quadratic are",root1,"and",root2)

# Complex root case.
else:

    # Get real and img parts.
    real = -b/(2*a)
    img = math.sqrt(-discriminant)/(2*a)

    # Print roots.
    print("Roots are ",real,"+",img,"i and ",real,"-",img,"i.", sep="")
