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

int main()
{
    float a,b,c;
    float x1,x2;
    printf("Enter the value of a:\n");
    printf("Enter the value of b:\n");
    printf("Enter the value of c:\n");
    scanf("%f",&a);
    scanf("%f",&b);
    scanf("%f",&c);
    printf("The Equation is %.2fx^2 + %.2fx + %.2f\n",a,b,c);
    x1=(-b+sqrt(b*b - 4*a*c))/2*a;
    x2=(-b-sqrt(b*b - 4*a*c))/2*a;
    if (x1==0 && x2==0)
    {
        printf("The roots are equal which is  %.2f",x1);
    }
    else if (x1>=0 && x2>=0)
    {
        printf("The roots are real\n");
        printf("THe real roots are %.2f,%.2f",x1,x2);
    }
    else if (x1<=0 && x2<=0)
    {
        printf("The roots are imaginary");
    }
    else if (x1 >=0 && x2<=0)
    {
        printf("one of the roots is real and the other is not\n");
        printf("the real root is %.2f",x1);
    }
    else if (x1<=0 && x2>=0)
    {
        printf("one of the roots is real and the other is not\n");
        printf("the real root is %.2f",x2);
    }
    else 
    {
        printf("Please enter a valid input");
    }
    return 0;
}

Embed on website

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