福约斯 发表于 2023-3-30 08:11:41

6

李跌的付清 发表于 2023-3-30 16:40:48

1

BigYellow 发表于 2023-3-30 20:14:46

我要看答案

yinda_peng 发表于 2023-3-31 17:08:34

answer

小六御文 发表于 2023-3-31 21:09:08

1

阿彬 发表于 2023-4-2 16:04:04

0.10个A
1.0个B
2.?
3.?
4.

12323sd 发表于 2023-4-3 13:15:20

1

W021024 发表于 2023-4-4 00:47:36

Brick_Porter 发表于 2023-4-4 12:57:17

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

void exercise0();
void exercise1();
void exercise2();
void exercise3();

int main()
{
    exercise0();
    exercise1();
    exercise2();
    exercise3();
    return 0;
}

void exercise0()
{
    int i;
    float profit_a, profit_b, principal, rate_a, rate_b;

    i = 0;
    profit_a = profit_b = principal = 10000;
    rate_a = 0.1;
    rate_b = 0.05;
    while (!(profit_b > profit_a))
    {
      profit_a += principal * rate_a;
      profit_b += profit_b * rate_b;
      i++;
    }
    printf("%d年后,黑夜的投资额超过小甲鱼!\n", i);
    printf("小甲鱼的投资额是:%.2f\n", profit_a);
    printf("黑夜的投资额是:%.2f\n", profit_b);
}

void exercise1()
{
    int year = 0, expense = 50, principal = 400;
    double rate = 0.08;
    while (principal > 0)
    {
      principal -= expense;
      principal += principal * rate;
      year++;
    }
    printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗……\n", year);
}

void exercise2()
{
    int mark, base;
    double pi, item;

    mark = base = 1;
    pi = 0;
    do
    {
      item = mark / (double)base;
      pi += item;
      mark = -mark;
      base += 2;
    } while (fabs(item) > 1e-8);
    printf("pi = %.7lf\n", 4 * pi);
}

int bunny(int i)
{
    if (i < 3)
      return 2;
    return bunny(i - 1) + bunny(i - 2);
}

void exercise3()
{
    printf("%ld\n", bunny(24));
}

18335681882 发表于 2023-4-4 14:38:25

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

FGNHBH 发表于 2023-4-4 14:48:00

dogdoggodlike 发表于 2023-4-4 22:00:17

2333

bianhua_j 发表于 2023-4-6 16:15:04

1

MuxiAcio 发表于 2023-4-6 18:51:53

T.T

二拾三 发表于 2023-4-8 10:42:06

{:9_230:}

晚风拾夕 发表于 2023-4-9 20:11:34

答案

KI_ 发表于 2023-4-10 16:01:06

Yvonne- 发表于 2023-4-11 00:20:01

1

裤头哥 发表于 2023-4-12 14:45:06

qweqweqweqweqwe

liunian233 发表于 2023-4-13 18:43:33

{:10_333:}
页: 248 249 250 251 252 253 254 255 256 257 [258] 259 260 261 262 263 264 265 266 267
查看完整版本: S1E16:拾遗 | 课后测试题及答案