Please check my code.
It is showing compilation error for input: 1 -8 16 but the answer is coming correct in my editor.
#include
#include
using namespace std;
int main ()
{
int a , b , c;
cin>>a>>b>>c;
int D = b * b - 4 * a * c;
int d = sqrt (D);
if (D > 0)
{
cout<<"Real and Distinct"<<endl;
int root1 = (-b + d) / (2 * a);
int root2 = (-b - d) / (2 * a);
cout<<root1<<" "<<root2;
}
else if (D == 0)
{
cout<<"Real and Equal"<<endl;
int root1 = (-b) / (2 * a);
int root2 = (-b) / (2 * a);
cout<<root1<<" "<<root2;
}
else
{
cout<<"Imaginary"<<endl;
}
return 0;
}