#include<stdio.h>
#include<stdlib.h>
#include <math.h>
int main()
{
float a, b, c, d, e, y;
printf("请分别输入一元二次方程中的a,b,c\n");
scanf_s("%f", &a);
scanf_s("%f", &b);
scanf_s("%f", &c);
y = b*b - 4 * a*c;
printf("公式值为%f\n",y);
d = b + (float)sqrt(y);
e = b - (float)sqrt(y);
if (y<0)
{
printf("此方程无解");
system("pause");
return 0;
}
else
{
printf("y1=%f y2=%f", d, e);
system("pause");
return 0;
}
}