Quadratics
Time limit1sMemory limit1024 MB
For each data set, read the coefficients a, b, c of a quadratic equation and print both real roots rounded to the thousandths place.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
After hearing that the quadratic formula is used constantly in calculus, you decide it would be more efficient to write a program for it. Write a program that solves the equation shown below:
The sign represents two equations, one with and one with . Your answer is both solutions, separated by a comma and a space.
Input
The first line contains a single integer , the number of data sets. Each of the following data sets is on its own line and contains three numbers , , and in that order. Each number is an integer or a decimal.
Output
Print both solutions rounded to the thousandths place, separated by a comma and one space. The solution for comes first, and the solution for comes second. The solutions are always real numbers.