Untitled

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

int main()
{
    float x;
    cin >> x;
    float y;
    cin >> y;
    float c;
    cin >> c;
    float result;
    float d;
    float kor;
    d = y * y - 4 * x * c;
    kor = sqrt(d);
    if (d > 0) {
        result = (-y + kor) / (2 * x);
        cout << result;
        result = (-y - kor) / (2 * x);
        cout << result;
    }
    else if (d == 0) {
        result = (-y) / (2 * x);
    }
    else cout << 'NO';
}
Editor is loading...