村头那棵树彡 发表于 2021-3-28 14:44:46

0
11

村头那棵树彡 发表于 2021-3-28 14:50:03

miaomaio 发表于 2016-3-20 21:54
0. 10个
1. 0个
2. a, b, c


第一个为什么是十个啊,开始的时候j都没有初始值昂

八咫乌 发表于 2021-3-28 17:28:44

afsaffassffsa

bingsha 发表于 2021-3-28 19:26:38

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


int main()
{
    double i, k, pi;
    int j = 1, a = 1;   
   

    for (i = 1, k = 1.0; fabs(k) >= pow(10, -8); i += 2, a++)
    {      
      k = j / i;
      pi = pi + k;
      j = -j;
    }
   
    printf("pi=%.7f和%d\n", 4 * pi, a);

    return 0;

}

#include <stdio.h>

int main()
{
    int month, new_family, old_family, total_family;

    old_family = 1, new_family = 1;

    for (month = 3; month <= 24; month++)
    {
      total_family = old_family + new_family;
      old_family = new_family;
      new_family = total_family;
    }
   
    printf("共繁殖了%d对小兔子\n", total_family - 1);

    return 0;

}

2872600217 发表于 2021-3-29 10:00:35

甲鱼

kkk纯粹 发表于 2021-3-29 15:59:34

111

didiaodexuanlu 发表于 2021-3-29 20:21:45

看答案

LGC贯靑 发表于 2021-3-29 22:30:41

1

Huwei1999 发表于 2021-3-29 22:47:49

mklq 发表于 2021-3-29 23:33:06

14,3,9

时生33 发表于 2021-3-30 01:04:33


Poissom 发表于 2021-3-30 15:42:12

答案

杨多多 发表于 2021-3-30 22:37:28

12

Mr.焘 发表于 2021-3-31 09:16:32

1

leiluo 发表于 2021-3-31 10:36:10

加油

3291350159 发表于 2021-3-31 22:21:36

测试题:
0:10
1:10
2:a b c d
3:
4:
A:        if(x < 0)
               {
                       z = (-x);
                      
                }
                else{
                        z = x;
                }
5:
if (size > 12)
{
       cost = cost * 1.05;
      flag = 2;
}
else
{
        bill = cost * flag;
}
B:
if (ibex > 14)
{
      sheds = 3;
}
sheds = 2;
      help = 2 * sheds;
C:

do{

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

}while(1);
动动手:
0:
#include <stdio.h>

int main()
{
        int i;
        double prince1 = 0.10, prince2 = 0.05, capital1, capital2, total1, total2 ;
        capital1 = 10000;
        capital2 = 10000;
        for(i = 1;; i ++)
        {
                total1 = i * prince1 * capital1 + capital1;
                total2 = prince2 * capital2 + capital2;
               
                capital2 = total2;
               
                if(total1 < total2)
                {
                        break;
                }
        }
        printf("%d年后黑夜的存款超过小甲鱼\n", i);
        printf("此时小甲鱼的存款为%.2f!\n", total1);
        printf("此时黑夜的存款为:%.2f\n", total2);
        return 0;
}
1:
#include <stdio.h>

int main()
{
        int i;
        long double prince1 = 0.10, prince = 0.08, capital1, capital2, total, total2 ;
        total = 4000000;
        for(i = 1;1; i ++)
        {
                total = total - 500000;
                total = total * prince + total;
               
                if(total <= 0)
                {
                        break;
                }
        }
        printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗", i);
        return 0;
}
2:

   

czx8951 发表于 2021-3-31 23:29:39

1

llYYYYYll 发表于 2021-4-1 20:28:00

0.9
1.10
2.a,b,c
3.b=5,c=11
4.
5.

zongxiong 发表于 2021-4-1 23:02:47

1

yjh0113 发表于 2021-4-2 13:25:17

1
页: 151 152 153 154 155 156 157 158 159 160 [161] 162 163 164 165 166 167 168 169 170
查看完整版本: S1E16:拾遗 | 课后测试题及答案