Cyeberpunk 发表于 2020-4-29 16:59:34

0.100个
1.10个
2.a b c
3.a=5b=5c=9
4.z=a>0?x:-x;
5.全部 标签后的语句放回原goto位置
0.

guard99 发表于 2020-4-29 19:58:58

0.100
1.9
2.c,b,a
3.a=14,b=5,c=9
4.z=x>=0?x:-x;
5.
if (size > 12)
{
      cost = cost * 1.05;
flag = 2;

}
    bill = cost * flag;

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

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

ggxggy 发表于 2020-4-29 22:04:31

参考答案

一抹灰 发表于 2020-4-30 09:42:22

作业写在另一台电脑了。

一悲先生 发表于 2020-4-30 10:49:23

23

BOOSGT8 发表于 2020-4-30 13:20:55

{:5_109:}

lovelysea 发表于 2020-4-30 15:12:20

6666

fredqy 发表于 2020-4-30 15:28:27

小甲鱼棒棒哒

绿甲鱼 发表于 2020-4-30 19:02:44

参考答案

guard99 发表于 2020-4-30 20:37:42

0.
#include <stdio.h>
void main()
{
        float fish=10000,night=10000,df;
        int i=1;
        df=fish*0.1;
        while(1)
        {
                fish+=df;
                night=night*1.05;
                if(night>=fish)
                {
                        printf("%d年后,黑夜的投资超过小甲鱼!\n",i);
                        printf("小甲鱼的投资是:%.2f\n",fish);
                        printf("黑夜的投资是:%.2f\n",night);
                        break;
                }
                i++;
        }
       
}
1.
#include <stdio.h>
void main()
{
        float fish=4000000;
        int i;
        while(fish>0)
        {
                fish-=500000;
                fish=fish*1.08;
                i++;
        }
        printf("%d\n",i-1);
}
2.
#include <stdio.h>
#include <math.h>
void main()
{
        int i=1;
        double s=0;
        while(fabs(1.0/i)>0.00000001)
        {
                s=s+1.0/i;
                i=-1*i;
                i=i>0?i+2:i-2;
        }
        printf("%lf\n",4*s);
}
3.

00AT00 发表于 2020-5-1 07:57:11

0. 90
1. 0
2. a, b, c
3. 14, 5, 9
4. if ( x < 0) z = -x; else z = x;
5.
if (size > 12)
{
    cost = cost * 1.05;
    flag = 2;
}
bill = cost * flag;

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

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

一色砂糖 发表于 2020-5-1 10:53:36

学习

kuangjy 发表于 2020-5-1 17:55:47

看看

syedyj 发表于 2020-5-1 21:08:46

111

yanchunjing 发表于 2020-5-1 22:14:07

看看答案

kiliop 发表于 2020-5-2 15:32:11

kevin22 发表于 2020-5-2 18:42:47

学习

小子翠 发表于 2020-5-2 20:27:42

0:10

1:10

2: a=5 b=5 c=5

3:a=3,b=3,c=6

4:z=x<0?-x:x

5:A:if (size > 12)
{
      cost = cost * 1.05;
      flag = 2;
}
    bill = cost * flag;
B:if (ibex > 14)
{
       sheds = 3;
}
else
sheds = 2;
help = 2 * sheds;

c:while (1)
{
scanf("%d", &score);
if (score < 0)
{
       printf("count = %d\n", count);
       break;
}
else
count++;
}


#include <stdio.h>

int main()
{
        double x=1000,h=1000;
        int n=0;
        do
        {
                x += 1000*0.1;
                h += h * 0.05;
                n++;
        }while(h<x);
        printf("%dÄêoó£¬oúò1μÄí¶×ê¶î3¬1yD¡¼×óã!\n",n);
        printf("D¡¼×óãμÄí¶×ê¶îêÇ:%lf\n",x);
        printf("oúò1μÄí¶×ê¶îêÇ:%lf",h);
    return 0;
}
1:#include <stdio.h>

int main()
{
        double i=4000000;
        int n=0;
        while(i>0)
        {
                i -= 500000;
                i += i * 0.08;
                n++;
        }
        printf("%dÄêoó£¬D¡¼×óã°ü1aáËËùóDμļò2ú£¬Ôù′λØμ½ò»Æ¶èçÏ′¡£¡£¡£",n);
        return 0;
}
2:不会

3:#include <stdio.h>

int main()
{
        int sum=2;
        for(int i=0;i<=24;i++)
        {
                sum *= 2;
        }
        printf("%d",sum);
        return 0;
}

lawyerlzc 发表于 2020-5-4 16:59:24

#include <stdio.h>

int main()

{
        double i=400.0 ;
        int year=0;
        while(i>0)
        {
                i=i*1.08;
                i=i-50;
                year++;
        }
        printf("%d年后",year);
}

zmc7586 发表于 2020-5-5 08:55:23

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