Spperman


私信TA

用户名:fan

访问量:63121

签 名:

优秀的程序员是没有女朋友的...

等  级
排  名 64
经  验 10136
参赛次数 0
文章发表 66
年  龄 19
在职情况 学生
学  校 河南师范大学
专  业 物联网

  自我简介:

单身是因为——太优秀了...

TA的其他文章

解题思路:





注意事项:





参考代码:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int liangjie(double a,double b,double c)
{
    double x1,x2,ret,t;
    t=b*b-4*a*c;
    ret=sqrt(b*b-4*a*c);
    x1=(-(b)+ret)/2*a;
        x2=(-(b)-ret)/(2*a);
printf("%lf %lf",x1,x2);
}
  double yijie(double a,double b,double c)
  {
      double x1,x2,ret;
ret=sqrt( b*b-4*a*c);
     x1=(-(b)+ret)/(2*a);
     x2=x1;
                   printf("%lf %lf",x1,x2);
  }
int main()
{
    double a,b,c;
    scanf("%lf%lf%lf",&a,&b,&c);
    if(b*b-4*a*c>0)
    {
    liangjie(a,b,c);
    }
    else if((b*b-4*a*c)==0)
    {
    yijie(a,b,c);
    }
    else
    {
        printf("无解");
    }
}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

没有实根,但是有虚根
2018-02-08 11:11:37
一元二次求根应该没问题。
2018-01-14 13:56:23
欢迎评论!
2018-01-14 13:53:24
  • «
  • 1
  • »