13583258192 发表于 2020-4-9 10:45:05

HalfNG 发表于 2020-4-9 11:56:43

ilovefishC{:10_256:}

sad、illness 发表于 2020-4-9 20:06:33

0.10个
1.10个
2.c、b、a
3.b=5 c=9 a=12
4.x!=0?z=fabs(x):z=0;
5.A:if (size > 12)
{
       cost = cost * 1.05;
      flag = 2;
}
else
{
   bill = cost * flag;
}
B:if (ibex > 14)
{
      sheds = 3;
}
else
{ sheds = 2;
help = 2 * sheds;
}
C:while(readin: scanf("%d", &score))
{    if (score < 0)
    {
      printf("count = %d\n", count);
   }
   else
    {
      count++;
   }
}

LiHX11 发表于 2020-4-10 11:36:04

。。

maochenxu000 发表于 2020-4-10 16:07:52

倒萨大

x1175017670 发表于 2020-4-11 11:58:50

{:5_109:}

MrzhangTerrence 发表于 2020-4-11 15:51:14

题有点小难

guzii 发表于 2020-4-11 20:28:12

0:10个A
1:0个B
2:a,b,c
3:b=5, c = 10, a = 15;
4:z = sqrt(x * x);
5:Aif(size > 12)
        {
                cost = cost * 1.05;
                flag = 2;
        }
        bill = cost * flag;

B
if(ibex > 14)
        {
                sheds = 3;
        }
        else
        {
                sheds = 2;
        }
        help = 2 * sheds;

C
        do
        {
                scanf("%d", &score);
                if(score < 0);
                {
                        printf("count = %d\n", count);
                }
                count++;
                continue;
        }while(1);

0.
#include <stdio.h>

int main()
{
        float a = 10000, xjy = 10000, hy = 10000;
        int b = 0;
       
        do
        {
                xjy = a * 10 / 100 + xjy;
                hy = hy * 5 / 100 + hy;
                b++;
        }while(hy < xjy);
       
        printf("%d年后,黑夜的投资额超过小甲鱼!\n", b);
        printf("小甲鱼的投资额是:%.2f\n", xjy);
        printf("黑夜的投资额是:%.2f\n", hy);
       
        return 0;
}

1:
#include <stdio.h>

int main()
{
        int i = 4000000, b = 0;
       
        do
        {
                b++;
                i = i - 500000;
                i = i * 8 / 100 + i;
        }while(i > 0);
       
        printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n", b);
       
        return 0;
}

2:
#include <stdio.h>
#include <math.h>

int main()
{
        double d, c;
        int a, b;
       
        for(a = 1, b = 1; 1; b += 2)
        {
                if(a = b)
                {
                        c = a / b;
                        continue;
                }
                d = -a / b;
                if(sqrt(d * d) < pow(10, -8))
                {
                        break;
                }
                c = c + d;
        }
       
        c = c * 4;
       
        printf("pi的近似值为%f\n", c);
       
        return 0;
}

3:
#include <stdio.h>

int main()
{
        int a = 1, b = 0, c = 0, d;
       
        for(; c != 24; c++)
        {
                if(c > 2 && c <= 6)
                {
                        a = a + 1;
                        b = b - 1;
                }
                else if(c > 6)
                {
                        b = b - a / 2;
                        a = a / 2 + a;
                }
                b = b + a;
        }
        d = a + b;
       
        printf("两年后可以繁殖%d对兔子\n", d);
       
        return 0;
}

hh_victoria 发表于 2020-4-12 08:50:42

查看答案

学姐控 发表于 2020-4-12 21:29:44

666

叶子你好 发表于 2020-4-12 22:28:31

做了一点

小小鱼呀嘿 发表于 2020-4-13 13:50:16

加油

vincent97 发表于 2020-4-14 08:51:24

0.10次
1.11个
2.c,b,a
3.a=14,b=5,c=9
4.z=x>=0?x:-x
5.A
if(size>12)
{
    cost=cost*1.05;
    flag=2;
}
else
{
bill=cost*flag
}
B
if(ibex>14)
{
sheds=3;
}
else
{
sheds=2;
help = 2*sheds;
}
C
scanf("%d",&score);
while(score>=0)
{
count++;
scanf("%d",&score);
}
printf("count=%d\n",count);

swagcz 发表于 2020-4-14 10:49:47

0.

A-Duai 发表于 2020-4-14 20:13:45

感谢楼主的无私分享

qz000502 发表于 2020-4-14 21:22:26

sulley 发表于 2020-4-14 21:44:05

答案

喵帕斯丶 发表于 2020-4-14 23:38:10

谢谢小甲鱼

dongwenjie 发表于 2020-4-15 09:54:30

0.90
1.
10
2.a,b,c
3
b=4
c=

4.
z=(x>=0 ? x : -x)
5.
A:if (size > 12)
{
      cost = cost * 1.05;
      flag = 2;
      break;
}
bill = cost * flag;

B
if (ibex > 14)
{
         sheds = 3;
         break;
}
sheds = 2;
help = 2 * sheds;

C
readin: scanf("%d", &score);
if (score < 0)
{
      goto stage2;
}
count++;
goto    readin;
stage2: printf("count = %d\n", count);

cjf1314520 发表于 2020-4-15 10:47:59

看看
页: 90 91 92 93 94 95 96 97 98 99 [100] 101 102 103 104 105 106 107 108 109
查看完整版本: S1E16:拾遗 | 课后测试题及答案