littleshu 发表于 2020-8-6 10:30:46

look

qjx 发表于 2020-8-6 11:36:36

1

MIKU神仙教主 发表于 2020-8-6 13:46:59

{:10_277:}

haocstudy 发表于 2020-8-6 16:54:51

{:10_249:}

浪子大鲨鱼 发表于 2020-8-7 10:22:25

小甲鱼!永远嘀神

找规律多实践 发表于 2020-8-7 10:48:47

数兔子
int rabbit = 2, mature = 2, infant = 0, infant_1 = 0; // infant代表刚出生的兔子,infant_1代表1个月的兔子
    for (int i = 0; i < 24; i++) {
      int temp_rabbit = rabbit, temp_mature = mature, temp_infant = infant, temp_infant_1 = infant_1;
      temp_rabbit += mature / 2 * 2;
      temp_mature += infant_1;
      temp_infant = mature / 2 * 2;
      temp_infant_1 = infant;
      rabbit = temp_rabbit;
      mature = temp_mature;
      infant = temp_infant;
      infant_1 = temp_infant_1;
    }
    printf("2年后一共有兔子%d只\n", rabbit);

Retr0 发表于 2020-8-7 18:33:04

#include <stdio.h>

int main(){
    long int n = 1,n0 = 0,n1 = 0,i,temp;
    for(i = 0;i <= 24;i++){
      temp = n;
      n += n1;
      n1 = n0;
      n0 = temp;
    }
    printf("%ld\n",n);
    return 0;
}

z2521367787 发表于 2020-8-7 18:35:18

1

mahuateng 发表于 2020-8-8 14:32:50

asssssssssssssssssssssssssssssssssssssssssssssssssssss

money0000 发表于 2020-8-8 16:11:51

兔子

haocstudy 发表于 2020-8-8 17:40:36

兔子的题 没想明白{:10_249:}

fresh_python 发表于 2020-8-9 20:32:02

0.10个A
1.10个B
2.a,b,c
3.a = 11,b = 5,c = 9
4.z = x>0 ? x:-x
5.if(size>12)
{
const = const * 1.05;
flag = 2;

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

do
{
scanf("%d",&score);
if(score<0)
{
printf("count = %d\n",count);
}
else
{
count++;
scanf("%d",&score);
}
}while(score<0);
动动手
0.#include<stdio.h>

int main()
{
        float money1 = 10000.0,money2 = 10000.0,jiayu,heiye;
        float rate1 = 0.1,rate2= 0.05;
        int year = 0;
        jiayu = money1;
        heiye = money2;
        do
        {
                jiayu = jiayu + money1 * rate1;
                heiye = heiye + heiye * rate2;
                year++;
        }while(heiye<=jiayu);
       
        printf("%d年后,黑夜的投资超过小甲鱼!\n",year);
        printf("小甲鱼的投资额是:%.2f\n",jiayu);
        printf("黑夜的投资额是:%.2f\n",heiye);
        return 0;
}
1.#include<stdio.h>

int main()
{
        float all = 4000000.0;
        float rate = 0.08;
        float spending = 500000.0;
        int year = 0;
        do
        {
                all = all - spending;
                all = all + all*rate;
               
                year++;
               
        }while(all>0);
       
        printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n",year);
       
        return 0;
}
2.#include <stdio.h>

int main()
{
        int i = 1,j;
        float x,sum = 0;
        for(j = 1; 1.0/j>pow(10,-6);j = j + 2)
        {
                sum = sum + i*(1.0/j);
                i = -i;
        }
        x = sum * 4;
       
        printf("圆周率为:%.7f\n",x);
       
        return 0;
}
3.#include<stdio.h>

int main()
{
        int rubbits = 2;
        int i;
        int year = 2;
       
        for(i = 0;i <= year*12; i = i+2)
        {
                rubbits *= 2;
       }
       
        printf("%d年后,可以繁殖%d对兔子!\n",year,rubbits/2-1);
       
        return 0;
}

龍先生爱C++ 发表于 2020-8-10 10:09:00

好难

文锦~湫 发表于 2020-8-10 19:41:52

0.该程序不会被执行,j没有初始化,10个;
1.0个;
2.a;
3.a=8,b=4,c=4;
4.-x<0?z=x:z=-x;
5.A if(size>12)
    {

wz3950 发表于 2020-8-11 19:47:03

核对答案

2350595389 发表于 2020-8-11 20:26:19

看看

Li.kd 发表于 2020-8-11 22:37:29

加油

wtfitis 发表于 2020-8-12 09:45:16

123

haoiyang 发表于 2020-8-12 10:25:59

加油

192410350 发表于 2020-8-12 15:01:10

1
页: 109 110 111 112 113 114 115 116 117 118 [119] 120 121 122 123 124 125 126 127 128
查看完整版本: S1E16:拾遗 | 课后测试题及答案