Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
342 B
0
Indexable
Never
#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;
	}
}