请叫我小叮当 发表于 2019-6-15 15:38:13

0:回答出10个'A'
1:一个都不会打印。
2:a = 5;
3: a == 14, b == 5, c == 9;
4: z = x > 0 ? x : -x;
5:A        if (size > 12)
        {
                cost = cost * 1.05;
                flag = 2;
        }
        else
        {
                bill = cost * flag;
        }
B:        if ( ibex > 14)
        {
                sheds = 3;
        }
        else
        {
                help = 2 * sheds;
        }
       
C:        while (score >= 0)
        {
                count++;
                scanf("%d", &score);
        }
       
        printf("count = %d\n", count);
动动手:
0:        for (years = 1; single >= compound; years++)
        {
                //l=p*i*n
                single = 10000 + (10000 * (0.1 * years));
                //s=p*(1+i)^n
                compound = (10000 * pow((1 + 0.05), years));
                ++year;
        }
       
        printf("%d年后,黑夜的投资额超过王八蛋!\n\
        王八蛋的投资额是:%.2f\n\
        黑夜的投资额是:%.2f", year, single, compound);
1:
        for (years = 1; total_amount > 0; years++)
        {
                total_amount = total_amount - 500000;
                total_amount = (total_amount * 0.08) + total_amount;
               
                if (total_amount <= 500000)
                {
                        total_amount = total_amount - total_amount;
                }
        }
       
        printf("%d年之后,会小王八^_^会败光所有家产,再次一穷二白。", years);
2:
3:

多放点香菜 发表于 2019-6-15 21:05:50

over

1067551775 发表于 2019-6-17 21:19:19

f

tanghuanfe 发表于 2019-6-18 13:32:34

么么哒小甲鱼

村名阿钊 发表于 2019-6-20 16:18:32

I love FishC.com!

piaoycws 发表于 2019-6-22 21:56:41

12

Vinci_ovo 发表于 2019-6-23 17:36:39

over

junyue 发表于 2019-6-23 22:06:45

坚持胜利

lulukay 发表于 2019-6-24 07:33:35

2

就是怂 发表于 2019-6-24 12:09:58

1

月蚀 发表于 2019-6-25 19:55:54

难受

飘逸的光头 发表于 2019-6-26 15:47:07

看答案

cage233 发表于 2019-6-26 16:15:14

0.10
1.0
2.5
3.出错

欣然_coder 发表于 2019-6-26 20:31:11

.

KulobaY_xiao 发表于 2019-6-27 19:52:22

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

夜雨闻铃 发表于 2019-6-27 20:58:41

看看

夜雨闻铃 发表于 2019-6-27 20:59:16

看看

xdlcj 发表于 2019-6-28 16:35:26

答案

ietar 发表于 2019-6-29 10:50:09

本帖最后由 ietar 于 2019-6-29 10:53 编辑

0
just 10

1
...没进循环啊

2
a

3
b=3,c=8 b=4 c=9 b=5 a=14

4
void main(){
        float x,z;
        printf("x=:");
        scanf("%f",&x);
        z = x>0?x:-x;
        printf("z=%f",z);
}

5
A
if (size > 12)
{
      cost = cost * 1.05;
      flag = 2;
}
bill = cost * flag;


B
if (ibex > 14)
{
      sheds = 3;
}
else{
        sheds = 2;
}
help = 2 * sheds;


C
scanf("%d", &score);
while (score >= 0)
{
      count++;
        scanf("%d", &score);
}
printf("count = %d\n", count);


0
#include <stdio.h>

void main(){
        int year;
        const float i1=0.1;
        const float i2=0.05;
        double xjy=10000, heiye=10000;
        for(year=0;heiye<=xjy;year++){
                xjy += 10000*i1;
                heiye *= (1+i2);
        }
        printf("after %d years, heiye gets more than xjy!\n",year);
        printf("xjy:%.2f\nheiye:%.2f",xjy,heiye);
}


1
#include <stdio.h>

void main(){
        int year;
        double base = 4000000;
        for(year=0;base>=0;year++){
                base -= 500000;
                base *= 1.08;
        }
        printf("after %d years, sjy sucks!\n",year);
}

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

void main(){
        double qpi=0,each=1;
        int n,count=0;
        for(n=1;fabs(each)>=1e-8;n++){
                each = pow(-1,(n+1))/(2*n-1);
                qpi += each;
                count += 1;
        }
        printf("pi=%.7f\ncount=%d",4*qpi,count);
}
这tm循环了5000万零1次 怪不得这么慢

3
92736 初项是2 2的fib嘛
#include <stdio.h>
#include <math.h>

void main(){
        int a1 = 2, a2=2, limit = 24, temp;
        // n1=2, n2=2, n3=n2+n1=4, n4=n3+n2=6, n5=n4+n3=10;
        for(int i=3;i<=limit;i++){
                temp = a2;
                a2 = a1+a2;
                a1 = temp;
        }
        printf("sum=%d",a2);
}

啊是‘对‘ 结果除以2就行了 46368

yjh19961228 发表于 2019-7-1 09:38:42

3
页: 40 41 42 43 44 45 46 47 48 49 [50] 51 52 53 54 55 56 57 58 59
查看完整版本: S1E16:拾遗 | 课后测试题及答案