hklck 发表于 2020-2-21 12:01:30

0.10次
1.10次
2.a,b,c
3.14,3,9
4.z=(-x>x)?-x:x;
5.

414605520 发表于 2020-2-21 13:32:06

kankan

逆の夜 发表于 2020-2-21 16:43:56

本帖最后由 逆の夜 于 2020-2-21 17:37 编辑

测试题:
0.10个
1.不打印
2.c b a
3.14 5 9
4.z=x>0?x:-x;
5.
A.if(size>12)
{
        cost *= 1.05;
        flag = 2;
}
bill = cost*flag;
B.if(ibex>14)
{
        sheds=3;
}
sheds=2;
help=2*sheds;
C.scanf("%d",&score);
if(score<0)
{
        printf("cont=%d\n",count);
}
count++;
动动手:
0.#include <stdio.h>
#include<math.h>
#define yu 10000.0
#define ye 10000.0

int main()
{
    double ye_sum,yu_sum;
        double lonely_rates=0.1,complex_rates=0.05;
        int year=0;
        while(++year)
        {
                yu_sum=yu+yu*lonely_rates*year;
                ye_sum=ye*pow(1+complex_rates,year);
                if(ye_sum>yu_sum)
                {
                        printf("%d年后,黑夜的投资额超过小甲鱼!\n",year);
                        printf("小甲鱼的投资额是:%.2lf\n",yu_sum);
                        printf("黑夜的投资额是:%.2lf\n",ye_sum);
                        break;
                }
       }
}
1.#include <stdio.h>
#include<math.h>

#define Expend 500000.0

int main()
{
        int year=0;
        double sum=4000000;
        while(++year)
        {
                sum=sum-Expend;
                if(sum<0)
                {
                        printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n",year);
                        break;
                }
                sum=sum*(1+0.08);
        }
}
2.#include <stdio.h>
#include<math.h>

int main()
{
        double pi_4=1,pi,temple;
        int count=0;
        while(++count)
        {
                temple=pow(-1,count)/(1+2*count);
                pi_4=pi_4+temple;
                if(fabs(temple)>=pow(10,-9)&&fabs(temple)<pow(10,-8))
                {
                        break;
                }
        }
        pi=4*pi_4;
        printf("π≈%.7lf",pi);
}
3.#include <stdio.h>

int main()
{
        int month;
        long int rabbits=0;
        long int count=1,count2=0;
        long int total_rabbits;
        for(month=1;month<4;month++)
        {
                rabbits=rabbits+count;
                if(month==2)
                {
                        count2=rabbits;
                }
        }
        for(month=4;month<24;month++)
        {
                total_rabbits=rabbits+count2;
                count2=rabbits;
                rabbits=total_rabbits;
        }
        printf("两年后可以繁殖%ld对兔子\n",total_rabbits);
}

欢乐家 发表于 2020-2-21 17:02:49

查看参考答案

郭生 发表于 2020-2-21 21:27:53

看看

旺仔demo 发表于 2020-2-22 09:39:32

3

ljcjy 发表于 2020-2-22 11:54:09

加油

诺臻_NuoZhen 发表于 2020-2-22 14:01:28

加油!加油!加油!

py笨萌新 发表于 2020-2-22 14:46:49

1

kevinyya 发表于 2020-2-22 16:16:24

答案

公主赛高 发表于 2020-2-22 18:07:32

看看

lovebeer2828 发表于 2020-2-22 21:27:32

来了老弟

guweijiang 发表于 2020-2-23 09:09:27

学习

ljchinofei 发表于 2020-2-23 10:40:04

不错

2416315024 发表于 2020-2-23 11:15:14

233333

老工头 发表于 2020-2-23 16:07:12

66666666666666666

可爱的华子 发表于 2020-2-23 16:08:49

看看

wccd 发表于 2020-2-23 16:57:56

丘岱安

我是你大哥哥 发表于 2020-2-23 22:41:19

1

zyx050320 发表于 2020-2-23 23:44:32

查看参考答案
页: 75 76 77 78 79 80 81 82 83 84 [85] 86 87 88 89 90 91 92 93 94
查看完整版本: S1E16:拾遗 | 课后测试题及答案