#include <stdio.h>
#include<math.h>

void main(){
    float a,b,c,d,r2,r1,r;
    printf("enter coefficients \n");
    scanf("%f%f%f",&a,&b,&c);
    
    d= (b*b)- (4 *a *c);
    printf("the value of d is %f \n",d);
    
    if(d>0) {
        r1=( -b+ sqrt(d))/ (2*a);
         r2=( -b+ sqrt(d))/ (2*a);
         printf("the root is %f",r1);
          printf("the root is %f",r2);
    }
    
    if(d==0){
        r= -b /(2*a);
        printf("roots are equal \n");
        printf("root 1= root 2 :%f",r);
    }
    
    if(d<0) {
        printf("roots are not real");
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: