Mistake in my code?

#include
#include
using namespace std;

int main() {

float a,b,c;
cin>>a>>b>>c;
float d = b*b-4*a*c;
float d1 = sqrt(b*b-4*a*c);
int x = (-b +d1)/(2*a);
int y = (-b - d1)/(2*a);
if(d>0){
	cout<<"the roots are real and distinct"<<endl;
	if(x<y){
		cout<<x<<" "<<y;
	}
	if(y<x){
		cout<<y<<" "<<x;
	}
}

if(d==0){
	cout<<"the roots are real and equal"<<endl;
	cout<<x<<" "<<y;

}

if(d<0){
	cout<<"the roots are imaginary";
}

return 0;

}

hey @deepaksehrawat150_50930f2fcb83f47e your code isn’t readable here
You can share this code using ide.codingblocks.com

  • A special url will be generated, share that url with me

ide.codingblocks.com/s/606388 is the url generated.

try to submit now


It’s passing all test cases.

it still failing all 3 test cases, in question constraints on a b c is also there , will you please tell me how to do it?

All test cases are getting passed when i am submitting the code i have given to you. Try to do it again.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.