📄 05.c
字号:
#include <math.h>
void main()
{float a,b,c,x1,x2,disc;
printf("input a b c:");
scanf("%f,%f,%f",&a,&b,&c);
if(fabs(a)<1e-6)
printf("\nthe equation is not a quadratic");
else
{disc=b*b-4*a*c;
if (disc<0)
printf("\nthe equation has not roots");
else
if(fabs(disc)<1e-6)
printf("\nthe equation has two roots:%8.4f",-b/(2*a));
else
{x1=(-b+sqrt(disc)/2*a);
x2=(-b-sqrt(disc)/2*a);
printf("\nthe equation has distinct real roots:%8.4f,%8.4f",x1,x2);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -