Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
#include<stdio.h>
#include<conio.h>
#include<math.h>

int main()
{
    float a,b,c,alf,bt,dlt;
    clrscr();

    printf("\n Enter a: ");
    scanf("%f",&a);

    printf("\n Enter b: ");
    scanf("%f",&b);

    printf("\n Enter c: ");
    scanf("%f",&c);

    dlt=b*b-4*a*c;

    if(dlt==0)
    {
        printf("\n ALPHA=BETA=%f",-b/(2*a));
    }
    elseif(dlt<0)
    {
        printf("\n Imaginary Roots");
    }
    else
    {
        alf=(-b+sqrt(dlt))/(2*a);
        bt=(-b-sqrt(dlt))/(2*a);
        printf("\n\n Alpha = %f\n Beta=%f\n",alf,bt);
    }

    getch();

    return 0;
}


[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 26-Mar-15 20:55pm
v2

1 solution

No. For a couple of reasons.

1) We don't know what is wrong with it. Could be compilation error, could be run time error.
2) We don't know what it is expected to do that it doesn't, or not expected to do that it does.
3) We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!

If it's a problem when you try to compile, look at the error message - and if you can't figure it out tell us what the message is and what line it is reporting on.
If it's a problem when you try to run the app, then try using the debugger to step though your code and see exactly what is going on.
If it's a problem where you don't know how to code to fit your task, then explain that, what your task is, and what you have tried.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900