#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
float a = 0, b = 0,c = 0;
float x1, x2,d = 0;
printf("请输入a,b,c:");
scanf("%f%f%f",&a,&b,&c);
d = b * b - 4 * a * c;
x1 = (-b + sqrt(d)) / 2*a;
x2 = (-b - sqrt(d)) / 2*a;
printf("%.2f %.2f",x1,x2);
return 0;
}
#include <stdlib.h>
#include <math.h>
int main()
{
float a = 0, b = 0,c = 0;
float x1, x2,d = 0;
printf("请输入a,b,c:");
scanf("%f%f%f",&a,&b,&c);
d = b * b - 4 * a * c;
x1 = (-b + sqrt(d)) / 2*a;
x2 = (-b - sqrt(d)) / 2*a;
printf("%.2f %.2f",x1,x2);
return 0;
}