为什么这个用于计算二次方程解的代码不起作用?

0 c formula quadratic

每当我尝试运行它时,它都会返回错误的解决方案,例如:
A:303
B:405
C:50

真正的解决方案:-0.13762776465722773
我的解决方案:-110079.531250

#include <stdio.h>
#include <math.h>
int main(){
    float a;
    float b;
    float c;
    float solution;
    float d;
    printf("A: ");
    scanf("%f", &a);
    printf("B: ");
    scanf("%f", &b);
    printf("C: ");
    scanf("%f",&c);
    d = b * b - 4 * a * c;
    solution = (-b - sqrt(d))/ 2*a;
    printf("%f", solution);
}
Run Code Online (Sandbox Code Playgroud)

Aks*_*hal 6

你忘记了BODMAS.替换(-b - sqrt(d))/ 2*a(-b - sqrt(d))/ (2*a)