A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a flowchart and C program to solve quadratic equations aX2+bX+C=0
Q:

Write a flowchart and C program to solve quadratic equations aX2+bX+C=0

0

Write a flowchart and  C program to solve quadratic equations aX2+bX+C=0

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

 

flowchart:

 

C code:

#include 
#include 
int main()
{
    double a, b, c, deter, root1,root2, rlans, imgans;
    printf("Enter the values for a, b and c \\n");
    scanf("%lf %lf %lf",&a, &b, &c);
    deter = b*b-4*a*c;
    if (deter > 0)
{
        root1 = (-b+sqrt(deter))/(2*a);
        root2 = (-b-sqrt(deter))/(2*a);
        printf("root1 = %.2lf and root2 = %.2lf",root1 , root2);
}
    else if (deter == 0)
{
        root1 = root2 = -b/(2*a);
        printf("root1 = root2 = %.2lf;", root1);
}
    else
{
        rlans = -b/(2*a);
        imgans = sqrt(-deter)/(2*a);
        printf("root1 = %.2lf+%.2lfi and root2 = %.2f-%.2fi", rlans, imgans, rlans, imgans);
}
    return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now