ab200849694 发表于 2021-9-3 09:16:37

11111

kazenomoney 发表于 2021-9-3 14:35:44

让我看看!

Rick_Grimes 发表于 2021-9-3 15:53:27

测试题:
0.
10

1.
0

2.
I value 是啥

3.
a = 14 , b = 5 , c = 9

4.
z = x >= 0 ? x : -x;

5.
if (size > 12){
    cost *= 1.05;
    flag = 2;
}
bill = cost * flag;

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

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

动动手
# include <stdio.h>
# include <math.h>

int main(){
       
        //动动手0
        float principal = 10000, interest1_year = 0, interest1_total = 0, interest2_year = 0, interest2_total = 0 , rate1 = 0.1 , rate2 = 0.05;
        int years = 0;
       
        while (interest1_total >= interest2_total){//利用循环计算两人总利润,超过时退出循环
                interest1_year = principal * rate1;
                interest2_year = (principal + interest2_total) * rate2;
                interest1_total += interest1_year;
                interest2_total += interest2_year;
                years++;
        }
       
        printf("%d年后,黑夜的投资额超过小甲鱼。\n",years);
        printf("小甲鱼的投资额是:%.2f。\n黑夜的投资额是:%.2f。\n",principal + interest1_total,principal + interest2_total);
        printf("\n");
       
        //动动手1
        float deposit = 400 , expense = 50, rate = 0.08;
        int years_t2 = 0;
        while (deposit > 0){
                deposit -= 50;
                deposit += deposit * rate;
                years_t2++;
        }
       
        printf("%d年之后,小甲鱼败光了所有家产,再次回到一贫如洗......\n",years_t2);
        printf("\n");
       
        //动动手2
        int i = 1 , j = -1;
        double pi_4 , num;
       
        while (fabs(num = 1.0 / i) > pow(10,-8)){
                pi_4 += num;
                i = j * (abs(i) + 2);
                j = -j;
        }
       
        printf("π≈%.7f\n",pi_4 * 4);
        printf("\n");
       
        //动动手3
        unsigned long long rabbits = 2;
       
       
        return 0;
       
}

星星快闪 发表于 2021-9-3 15:54:06

2021

南郭先生 发表于 2021-9-3 16:33:30

1

k纸上尘 发表于 2021-9-4 10:10:27

终于轻松了点

gjfyyds 发表于 2021-9-4 19:51:57

俺不会

anyway丶 发表于 2021-9-5 00:44:06

#include <stdio.h>
#include <math.h>
#define BJ 10000

int main()
{
    int year = 1;
    float m_yu,m_min;   
    for(year = 1; ;year++)
    {
      m_yu = BJ + BJ * 0.1 * year;
      m_min = BJ * pow((1 + 0.05),year);
      if(m_yu < m_min)
            break;
    }
    printf("%dyears!\n",year);
    printf("m_yu=%.2f,m_min=%.2f\n",m_yu,m_min);
    return 0;
}

1.#include <stdio.h>
#include <math.h>
#define BJ 4000000
#define COST 500000

int main()
{
    float asset = BJ;
    int year = 0;
    while(asset>0)
    {
      asset = asset - COST;
      asset = asset * (1 + 0.08);
      year++;
    }
    printf("%dyears!\n",year);

    return 0;
}

3.#include <stdio.h>
int Fn(int i);

int main()
{
    int k = 12 * 2;
    int total;
    total = Fn(k);
    printf("total=%d\n",total);
    return 0;
}
int Fn(int i)
{
    if(i<0)
      return -1;
    if(i==0)
      return 0;
    if(i==1)
      return 2;
    int res,b=2,c=0,j;
    for(j=2;j<i;j++)
    {
      res = b+c;
      c=b;
      b=res;
    }
    return res;
}

起名好难a 发表于 2021-9-5 18:19:21

1

闪耀晨曦 发表于 2021-9-5 20:54:57

0.10个
1.0个
2.a.b.c
3.a = 14 , b = 5 , c = 9

surgeMing 发表于 2021-9-5 22:03:15

zhenxiangzhid

单走一个2516 发表于 2021-9-6 11:24:14

橘丶 发表于 2021-9-6 18:57:30

朕想看

灵若水 发表于 2021-9-6 21:04:06

1

宇宙大队长 发表于 2021-9-7 02:20:10

啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊

lanxii 发表于 2021-9-7 08:49:23

好耶

Merciless 发表于 2021-9-7 18:18:00

1

qhan 发表于 2021-9-7 21:23:22

1

guiding 发表于 2021-9-7 21:39:26

10次
10次
abc
10+4 14
m = b>0?x = b;x = -b




1 1 2 3 5 8 13
不太会

藤本tree 发表于 2021-9-7 23:31:42

100
9
a=5
页: 177 178 179 180 181 182 183 184 185 186 [187] 188 189 190 191 192 193 194 195 196
查看完整版本: S1E16:拾遗 | 课后测试题及答案