#include<stdio.h>
#include<math.h>
int main()
{
//定义变量
double a, b, c, x1, x2, x3, A;
//输入数字
scanf("%lf %lf %lf",&a, &b, &c);
//算式计算
A = b*b - 4*a*c;
x1 = ( -b + pow( A, 1.0/2.0) )/ (2*a);
x2 = ( -b - pow(A, 1.0/2.0) )/ (2*a);
x3 = pow(4*a*c - b*b,1.0/2.0)/(2*a);
if(A >= 0)
{
if(A == 0 && a != 0 && b != 0)
printf("%.2lf",x1);
if(A > 0 && a != 0 && b!=0)
printf("%.2lf\n%.2lf",x1,x2);
if(a == 0 && b == 0 && c == 0)
printf("Zero Equation");
if(a == 0 && b == 0 && c != 0)
printf("Not An Equation");
if(a == 0 && b != 0 && c != 0)
printf("%.2lf",-c/b);
}
else
{
printf("%.2lf+%.2lfi\n",-b / 2*a,x3);
printf("%.2lf-%.2lfi\n",-b / 2*a,x3);
}
return 0;
}
09-22
1144
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-13
437
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)