#25430: _QWD


antony9399@gmail.com (03楊騏安)


#include <iostream>

#include <math.h> 

using namespace std;

 

int main()

{

int a,b,c,d;

float x1,x2;

 

cin>>a,b,c;

d=b*b-4*a*c;

 

if(d>0)

{

x1=((-b+sqrt(d))/2*a);

x2=((-b-sqrt(d))/2*a);

cout<<"Two different roots x1="<<x1<<" , x2="<<x2<<endl;

}

 

else if(d==0) 

cout<<"Two same roots x="<<x1<<endl;

 

else 

cout<<"No real root"<<endl;

}