#include<stdio.h>
#include<math.h>
int main(void)
{
    int a,b,c;
    double m;
    scanf("%d%d%d",&a,&b,&c);
    while((a!=0)&&(b!=0)&&(c!=0)){
        if(a==0){
            printf("Error!");}
        m=b*b*1.0-4*a*c;
        if(m>0)
           printf("x1=%lf 
 x2=%lf",(-b+sqrt(m)*1.0)/(2*a),(-b-sqrt(m)*1.0)/(2*a));
        else if(m==0)
           printf("x1=x2=%lf",(-b)*1.0/(2*a));
        else
           printf("No solution!");
        scanf("%d %d %d",&a,&b,&c);
    }
    return 0;
}
原文地址:https://www.cnblogs.com/shenyunwen/p/3447110.html