Untitled
unknown
plain_text
3 years ago
342 B
3
Indexable
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
float a, b, c, x, xx, D;
cin >> a>> b>> c;
D = b * b - 4 * a * c;
if (D < 0)cout << "NO";
else if (D == 0) {
x = -b / (a * 2);
cout << x;
}
else
{
x = (-b - sqrt(D))/(2 * a);
xx = (-b + sqrt(D)) / (2 * a);
cout << x <<"\n"<<xx;
}
}
Editor is loading...