C语言实验题——一元二次方程 II#include #include int main (){double a,b,c,x1,x2,d;scanf ("%lf %lf %lf",&a,&b,&c);d=b*b-4*a*c;x1=(-b+sqrt(d))/(2*a);x2=(-b-sqrt(d))/(2*a);if (x1>x2){printf ("%.2lf %.2lf",x1,x2);}if (x2>x1){ printf("%.2lf %.

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 08:19:58

C语言实验题——一元二次方程 II#include #include int main (){double a,b,c,x1,x2,d;scanf ("%lf %lf %lf",&a,&b,&c);d=b*b-4*a*c;x1=(-b+sqrt(d))/(2*a);x2=(-b-sqrt(d))/(2*a);if (x1>x2){printf ("%.2lf %.2lf",x1,x2);}if (x2>x1){ printf("%.2lf %.
C语言实验题——一元二次方程 II
#include #include
int main ()
{
double a,b,c,x1,x2,d;
scanf ("%lf %lf %lf",&a,&b,&c);
d=b*b-4*a*c;
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
if (x1>x2)
{
printf ("%.2lf %.2lf",x1,x2);
}
if (x2>x1)
{
printf("%.2lf %.2lf",x2,x1);
}
double m,n;
m=-b/(2*a);
n=sqrt(-d)/(2*a);
printf ("%.2lf+%.2lfi %.2lf-%.2lfi\n",m,n,m,n);
return 0;
}
#include
#include
int main ()
{
double a,b,c,x1,x2,d;
scanf ("%lf %lf %lf",&a,&b,&c);
d=b*b-4*a*c;
if (d>=0)
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
}
if (x1>x2)
{
printf ("%.2lf %.2lf",x1,x2);
}
if (x2>x1)
{
printf("%.2lf %.2lf",x2,x1);
}
if (d

C语言实验题——一元二次方程 II#include #include int main (){double a,b,c,x1,x2,d;scanf ("%lf %lf %lf",&a,&b,&c);d=b*b-4*a*c;x1=(-b+sqrt(d))/(2*a);x2=(-b-sqrt(d))/(2*a);if (x1>x2){printf ("%.2lf %.2lf",x1,x2);}if (x2>x1){ printf("%.2lf %.
想问什么啊