sqrtEquation :: (Floating a, Floating b, Floating c) => a -> b -> c -> String sqrtEquation a b c | d < 0 = "No solutions" | d == 0 = (show x1) | d > 0 = (show x1) ++ " and " ++ (show x2) where d = (b*b - 4*a*c) x1 = ((-b + sqrt(d))/2*a) x2 = ((-b - sqrt(d))/2*a) main = do putStr "Input a:" a <- getLine putStr "Input b:" b <- getLine putStr "Input c:" c <- getLine let result = sqrtEquation (read a) (read b) $ read c putStrLn result