MC.Steve 发表于 2025-12-20 09:30:50

wogy6121 发表于 2025-12-22 14:19:03

1

Rayer 发表于 2025-12-24 16:33:16

0.10
1.0
2.a b c
3.13 3 8
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;
}
sheds = 2;
help = 2 * sheds;
C.do{
        readin: scanf("%d", &score);
        printf("count = %d\n", count);
        count++;
}while(score < 0)
0.#include <stdio.h>
int main()
{
        float xjy=10000,hy=10000;
        int i;
        do
        {
                xjy+=1000;
                hy*=1.05;
                i++;
        }while(hy<xjy);
        printf("%d年后,黑夜的投资额超过小甲鱼!\n",i);
        printf("小甲鱼的投资额是:%.2f\n",xjy);
        printf("黑夜的投资额是:%.2f\n",hy);
        return 0;
}      
1.#include <stdio.h>
int main()
{
        int s=400,i=0;
        do
        {
                s-=50;
                s*=1.08;
                i++;
        }while(s>0);
        printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......",i);
}
2.#include <stdio.h>
int main()
{
        double pi=0;
        double fz=1,fm=1,s=0;
        int sign=1;
        do
        {
                s+=(fz*sign)/fm;
                fm+=2;
                sign=-sign;
        }while((fz/fm)>1e-8);
        pi=4*s;
        printf("%.7f",pi);
        return 0;
}
3.#include <stdio.h>
int main()
{
        int s1=1,s2=1,i=0;
        do
        {
                s1+=s2;
                s2+=s1;
                i++;
        }while(i<11);
        printf("%d",s2);
        return 0;
}

BarryTZJ 发表于 2025-12-28 10:42:19

答案

沐熙清 发表于 2026-1-1 13:50:30

10
10
c = 5, b = c, a = b
14 5 9
if(x < 0) { z = -x; } else if (x > 0) { z = x; }
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:
if (score < 0) { printf("count = %d\n", count)} else {count++}
#include <stdio.h>
#include <math.h>
int main(){
    int count = 1, TF = 1;
    double x, y;
    do {
      x = 10000 * 0.1 * count + 10000;
      y = 10000 * pow((1 + 0.05), count);
      if (x < y){
            TF = 0;
      }
      count++;
    } while (TF);
   
    printf("%d年后,黑夜的投资额超过小甲鱼!\n", count - 1);
    printf("小甲鱼的投资额是:%.2f\n", x);
    printf("黑夜的投资额是:%.2f\n", y);

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

    return 0;
}
#include <stdio.h>
#include <math.h>
int main(){
    int count=0, num = 1, i=1;
    double sum=0.0;
    double term;
    do {
      term = (double)1 / num;
      sum += i * term;
      i = -i;
      num += 2;
    } while (fabs(term) >= pow(10, -8));
    printf("Pi的近似值为%.7lf", sum * 4);

    return 0;
}
#include <stdio.h>
#include <math.h>
int main(){
    int parent = 2, child1 = 0, child2 = 0;
    int time;
    for (time = 0; time < 24; time++)
    {
      parent += child2;
      child2 = child1;
      child1 = parent / 2;
    }
    printf("两年后可以繁殖出%d对", child1 / 2);
    return 0;
}

dididi1999 发表于 2026-1-7 10:33:34

看答案

vertin 发表于 2026-1-9 19:01:11

daan

重庆刘德华 发表于 2026-1-21 09:08:53

1

落落,,, 发表于 2026-1-27 18:47:15

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

yang69 发表于 6 天前

{:5_101:}

要学好c 发表于 昨天 14:52

1
页: 282 283 284 285 286 287 288 289 290 291 [292]
查看完整版本: S1E16:拾遗 | 课后测试题及答案