Untitled
unknown
c_cpp
a month ago
431 B
5
Indexable
#include <iostream>
using namespace std;
int main()
{
{
float a,b,c,d,x1,x2;
cin >> a >> b >> c;
d = b*b - 4*a*c;
if(d < 0) cout << "Vo nghiem";
else if(d == 0)
cout << "x = " << -b/(2*a);
else
{
x1 = (-b + sqrt(d))/(2*a);
x2 = (-b - sqrt(d))/(2*a);
cout << "x1 = " << x1 << endl;
cout << "x2 = " << x2;
}
return 0;
}
}
Editor is loading...
Leave a Comment