The Quadratic Equation
View as PDF
Submit solution
Points:
3
Time limit:
2.0s
Memory limit:
64M
Author:
Problem type
Allowed languages
Java
The quadratic formula can be used to calculate the roots (values of x) for any equation of the format .
The quadratic formula is as follows:
Determine whether or not a quadratic equation has real roots, then determine if there are multiple. If there are multiple roots, find them.
Input
The first line is the value of .
The second line is the value of .
The third line is the value of .
These values will be between and
. They will not be
.
Output
If there are no real roots, print No real roots. If there is real root, print
One real root., otherwise print the roots rounded to decimal places with each root on a new line with
followed by
.
Do not print trailing zeros.
Sample Input 1
1
5
23
Sample Output 1
No real roots.
Sample Input 2
95
101
15
Sample Output 2
-0.18
-0.88
Comments