#include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { double a, b, c, x1, x2, s; cin >> a >> b >> c; s = b*b - 4 * a*c; x1 = (-1 * b + sqrt(s)) / 2 * a; x2 = (-1 * b - sqrt(s)) / 2 * a; cout << setprecision(2) << setiosflags(ios::fixed) << x1 << " " << x2 << endl; return 0; } |
Double click to view unformatted code.