Untitled
unknown
c_cpp
2 years ago
506 B
8
Indexable
#include <iostream>
#include <math.h>
#include <cmath>
using namespace std ;
int main()
{
float x1, x2 = 0;
float D = 0;
float a, b, c = 0;
cin >> a >> b >> c;
D = (b * b) - (4 * a) * c;
if (D > 0) {
x1 = (sqrt(D) + (-b)) / (2 * a);
x2 = ((-b) - sqrt(D) ) / (2 * a);
cout << x1;
cout << x2;
}
else if (D == 0) {
x1 = ((-b)) / (2 * a);
cout << x1;
}
else cout << "NO";
}
Editor is loading...