Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Turbo C Quadratic Equation

daotdaot Posts: 1Member
Hi. Good Day.

Is there anybody who can help me with my project in turbo C....
The logic must be like this, THE USER WILL INPUT A QUADRATIC EQUATION AND IT WILL BE DETERMINED IF THE EQUATION IS FACTORABLE OR NOT.

THE OUTPUT MUST BE LIKE THIS:
IF FACTORABLE THEN
SOLVE THE EQUATION
PRINT THE ANSWER
ELSE THEN
PRINT "THE EQUATION IS NOT FACTORABLE"

Any help...thanx a lot.

Comments

  • mike_phdmike_phd Posts: 9Member
    #include
    #include
    main()
    {
    int a,b,c;
    float x1,x2,D;
    printf("Enter the Values of a,b,c:");
    scanf("%d%d%d",&a,&b,&c);
    D=b*b-4*a*c;
    if(D==0)
    {
    printf("THE EQUATION IS FACTORABLE and the Roots are equal.
    ");
    x1= -b/(2*a);
    printf("Root=%f
    ",x1);
    }
    else if(D<0)
    {
    printf("THE EQUATION IS NOT FACTORABLE.
    ");
    x1=-b/(2*a);
    x2=sqrt(-D)/2*a;
    printf("Roots are %f+%fi and %f-%fi
    ",x1,x2,x1,x2); }
    else if(D>0)
    {
    x1=(-b+sqrt(D))/(2*a);
    x2=(-b-sqrt(D))/(2*a);
    printf("THE EQUATION IS FACTORABLE.
    ");
    printf("Roots are %f and %f
    ",x1,x2);
    }
    else
    {
    printf("The given equation is linear.
    ");
    x1=-c/b;
    printf("Root=%f
    ",x1);
    }
    }


    Essays & Dissertations Qualified
    South Carolina University
Sign In or Register to comment.