#include<<math.h>> #include<iostream> using namespace std; int main () { int a,b,c,d,e,f; while (cin >> a >> b >> c ) d=(-b+sqrt(b*b-4*a*c))/2*a e=(-b-sqrt(b*b-4*a*c))/2*a f=(-b)/2*a if (b*b-4*a*c > 0) { cout << "Two different roots x1=" << d << ", x2=" << e << endl; } else if (b*b-4*a*c=0) { cout << "Two same roots x=" << f << endl; } else { cout << "No real root" << endl ; } }
#include<> #include using namespace std; int main () { int a,b,c,d,e,f; while (cin >> a >> b >> c ) d=(-b+sqrt(b*b-4*a*c))/2*a e=(-b-sqrt(b*b-4*a*c))/2*a f=(-b)/2*a if (b*b-4*a*c > 0) { cout << "Two different roots x1=" << d << ", x2=" << e << endl; } else if (b*b-4*a*c=0) { cout << "Two same roots x=" << f << endl; } else { cout << "No real root" << endl ; } }