#include<stdio.h>
#include<math.h>
int main()
{
float a,b,c,p,q;
scanf("%f %f %f",&a,&b,&c);
float less(double a,double b,double c)
{
p=-b/(2*a);
q=sqrt(4*a*c-b*b)/(2*a);
printf("x1=%.3f+%.3fi x2=%.3f-%.3fi",p,q,p,q);
return 0;
}
float more(double a,double b,double c)
{
p=-b/(2*a);
q=sqrt(b*b-4*a*c)/(2*a);
printf("x1=%.3f+%.3f x2=%.3f-%.3f",p,q,p,q);
return 0;
}
float equal(double a,double b,double c)
{
p=-b/(2*a);
printf("x1=%.3f x2=%.3f",p,p);
return 0;
}
if((b*b-4*a*c)>0)
{
more(a,b,c);
}
else if((b*b-4*a*c)==0)
{
equal(a,b,c);
}
else
{
less(a,b,c);
}
}
0.0分
0 人评分
A+B for Input-Output Practice (VI) (C++代码)浏览:445 |
淘淘的名单 (C语言代码)答案错误???浏览:624 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:584 |
简单的a+b (C语言代码)浏览:674 |
WU-格式化数据输出 (C++代码)浏览:1312 |
矩形面积交 (C++代码)浏览:1204 |
简单的a+b (C语言代码)浏览:618 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:569 |
Hello, world! (C语言代码)浏览:916 |
C二级辅导-统计字符 (C语言代码)浏览:695 |