I tried to write a code to find the roots of the equation without the mat.h library The code does not work when delta is bigger than zero, why might it be due?
void find_root(){
double a,b,c;
double delta;
double num=0;
double root_1,root_2;
printf("Please Enter the first coefficient");
scanf("%lf",&a);
printf("Please Enter the second coefficient");
scanf("%lf",&b);
printf("Please Enter the third coefficient");
scanf("%lf",&c);
delta=(b*b)-(4*a*c);
if(delta>=0){
while(delta!=num*num){
num=num+0.001;
}
root_1=(-b+num)/(2*a);
root_2=(-b-num)/(2*a);
printf("Your equation %.1lfx^2 + %.1lfx + %.1lf have real roots {%.1lf,%.1lf}",a,b,c,root_1,root_2);
}
else {
printf("Your equation %.1lfx^2 + %.1lfx + %.1lf does not have any real roots",a,b,c);
}
}