躲在壁炉里 发表于 2025-11-4 15:51:17

10 ;11 ;;   ;

KoishiYu 发表于 2025-11-4 20:15:41

1

JPai 发表于 2025-11-6 19:42:38

0. 10
1. 9
2. c=5, b=c, a=b
3.14 5 9
4. z= x>=0 ? x : -x
5.

0.
#include <stdio.h>
#include <math.h>
int main()
{
    int year;
    float a, b;
    a = 10000;
    b = 10000;

    for(year = 0; a >= b; year++)
    {
      a = a + 10000*0.1;
      b = b * 1.05;
    }

    printf("%i年后,黑夜的投资额超过小甲鱼!\n小甲鱼的投资额为%.2f元\n黑夜的投资额为%.2f元",year, a, b);
   
    return 0;
}
1.
#include <stdio.h>
#include <math.h>
int main()
{
    int year;
    float a;
    a = 400;

    for(year = 0; a >= 0; year++)
    {
      a = (a-50) * 1.08;
    }

    printf("%i年后,小甲鱼败光了所有的家产,再次回到一贫如洗", year);
   
    return 0;
}
2.
#include <stdio.h>
int main()
{
    double a, b, k;
    double pai = 0;
   
    for(a = 1, b = 1; a/b >= 0.00000001; b = b + 2)
    {
      int i = b;
      if((i % 4) == 3)
      {
            k = -(a/b);
      }

      else if((i % 4) == 1)
      {
            k = a/b;
      }

      pai = pai + k;
    }
   
    float sum;
    sum = 4*pai;
3.
#include <stdio.h>
int main()
{
    int month, a, b, c;
    a = 1;
    b = 1;

    for(month = 0; month <= 24; month++)
    {
      c = a + b;
      a = b;
      b = c;
    }
    printf("两年后共有%i对兔子",c);

    return 0;
}

    printf("Pi的近似值为%.7f",sum);

    return 0;
}
3.

Dayslove 发表于 2025-11-6 22:01:22


AAAAer 发表于 2025-11-10 16:57:23

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

i'love'le'e 发表于 2025-11-11 21:25:19

答案

Winter_Sun 发表于 2025-11-15 22:48:26

1

情冰 发表于 2025-11-16 13:59:10

1

超神奇葩天才 发表于 2025-11-17 11:02:56

#include <stdio.h>
int main() {
    int n = 10000;
    float y = n;
    float h = n;
    int count=0;
    while(y>=h) {
      y = y + n * (0.1);
      h = h * (1+0.05);
      count++;
    }
    printf("%d年后,黑夜的投资额将超过小甲鱼!\n", count);
    printf("小甲鱼的投资额是: %.2f\n", y);
    printf("黑夜的投资额是: %.2f\n", h);
    return 0;
}
#include <stdio.h>
int main(){
    float n = 4000000;
    int time=0;
    while(n > 0){
      n -= 500000;
      n *= 1.08;
      time++;
    }
    printf("%d年之后,小甲鱼败光了所有家产,再次回到一贫如洗...",time);
    return 0;
}
#include <stdio.h>
#include <math.h>
int main(){
    int n=1;
    float sum = 0,pi=0,i=0,x=1.0;
    while(1){
      i = x/n;
      if(fabs(i)<10e-8){
            break;
      }
      sum += i;
      n += 2;
      x = -x;
    }
    pi = 4*sum;
    printf("pi = %f\n",pi);
}
#include <stdio.h>
int main (){
    int n,a,b;
    a = 0;
    b = 1;
    for(int i = 0;i < 24;i++){
      n = a;
      a = b;
      b = n + b;
    }
    printf("%d",b*2);
}

lemonade111 发表于 2025-11-17 21:04:31

13312442zzb 发表于 2025-11-19 20:57:45

从v你吃饭才能

木耳一道 发表于 2025-11-20 12:37:53

1

木耳一道 发表于 2025-11-20 17:04:06

1

anhedemo 发表于 7 天前

0

hedaren_fc 发表于 昨天 17:52

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