求导大神指导C语言题目,我是新手,

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/27 12:55:42

求导大神指导C语言题目,我是新手,
求导大神指导C语言题目,我是新手,

求导大神指导C语言题目,我是新手,

5.4:(a)输出:2 0

         (b)输出:1 1

6.9:(a)输出:-1

        (b)输出:0

        (c)输出:5555555.

        (d)输出:10 8

5.10:

//没测试过,可能有笔误
#include <stdio.h>
#include <math.h> //可以用math.h的库吗

//顺便说一下,那个求根公式貌似写错了,-b应该放在分子上的吧. 
int main()
{
    double a, b, c;
    printf("issue the values of a, b, c(divided by space):"): 
    scanf("%d%d%d");
    if (a == 0)
    { 
        if (b == 0)
            printf("the root is: %d", c):
        else
            printf("the root is: %d", -c / b);  
        goto END; 
    } 
    double delta = b * b - (4 * a * c);
    if (delta > 0)//two real roots
          printf("the roots is: %d and %d", (-b + sqrt(delta)) / 2 * a, (-b - sqrt(delta)) / 2 * a);
    else if (delta == 0)
          printf("the root is: %d", (-b + sqrt(delta)) / 2 * a);
    else
        printf("there are no real roots!"); 
END:;  
}

额,还有.6.9的c项是我看错了吗?目测是个死循环.

个人临时做的供参考,有错谢谢指正.