Quadratic eqn 1 testcase failed

#include
#include<math.h>
using namespace std;
int main() {

int a,b,c,k;
cin>>a>>b>>c;
k=b*b-4*a*c;
if(k>0)
{
    cout<<"Real and Distinct"<<endl;
    cout<<((-b-sqrt(k))/(2*a))<<" "<<((-b+sqrt(k))/(2*a))<<endl;
}
else if(k==0)
{
    cout<<"Real and Same"<<endl;
    cout<<((-b-sqrt(k))/(2*a))<<" "<<((-b+sqrt(k))/(2*a))<<endl;
    //cout<<((-b)/(2*a))<<" "<<((-b)/(2*a))<<endl;
}
else if(k<0)
{
    cout<<"Imaginary"<<endl;
}


return 0;

}

1 Like

Hello @POORVI_SAXENA

You need to print “Real and Equal” and NOT “Real and Same” !!

1 Like