#include<stdio.h>
#include<math.h>
int main(){
double a,b,c,x1,x2;
scanf("%lf,%lf,%lf",&a,&b,&c);
printf("%lfx^2+%lfx+%lf=0",a,b,c);
if(b*b-4*a*c>0){
x1=(-b-sqrt(b*b-4*a*c))/2;
x2=(-b+sqrt(b*b-4*a*c))/2;
printf("x1=%.2lf,x2=%.2lf,x1,x2);
}
else if(b*b-4*a*c==0){
x1=x2=-b/2;
printf("x1=x2=%.2lf",x1);}else
{printf("此方程无解!");}
return 0;
} |