Untitled

 avatar
unknown
plain_text
2 years ago
431 B
3
Indexable
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    float a, b, c, d, x, xx;
    cin >> a >> b >> c;

    d = b * b - 4 * a * c;

    if (d == 0)
    {
        x = b * -1 / (a * 2);
        cout << x;
    }
    if (d > 0)
    {
        x = (b * -1 + sqrt(d)) / (a * 2);
        xx = (b * -1 - sqrt(d))/ (a * 2);
        cout << x << " " << xx;
    }
    if (d < 0) cout << "NO";
}
Editor is loading...