Ityok 发表于 2020-6-18 23:09:39

测试题

0.
10次

1.
0次

2.


3.
a==14
b==5
c==9

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;
}
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>

int main()
{
        float xjy=10000, hy=10000;
        int year=0;

        do
        {
                xjy = xjy + 1000;
                hy = hy + (hy * 0.05);
                year++;
        }
        while (hy < xjy);

        printf("%d年后,黑夜的投资超过小甲鱼!\n", year);
        printf("小甲鱼的投资额是: %.2f\n", xjy);
        printf("黑夜的投资额是: %.2f", hy);
       
       

        return 0;
}

1.
#include <stdio.h>

int main()
{
        float xjy=4000000;
        int year=0;

        do
        {
                xjy = xjy - 500000;
                xjy = xjy + (xjy * 0.08);
                year++;
        }
        while (xjy > 0);

        printf("%d年后,小甲鱼败光了所有家产", year);
        return 0;
}

2.


3.

coutcin 发表于 2020-6-18 23:23:38

666

肖1213 发表于 2020-6-19 21:36:07

答案

zzn777 发表于 2020-6-20 07:16:18

{:5_109:}

xzzyg 发表于 2020-6-20 16:19:14

0.10
1.0
2.a
3.c=9,b=5,a=21
4.z=(x>0? x:-x)
5.
A
if (size > 12)
{
      cost = cost * 1.05;
}
else
{
    flag = 2;
   bill = cost * flag;

}
B
if (ibex > 14)
{
         sheds = 3;
}
{sheds = 2;
help = 2 * sheds;}
C
if (score < 0)
{
    printf("count = %d\n", count);
}
count++;
scanf("%d", &score);

动动手
0.
#include"stdio.h"
#include"math.h"
int main()
{
    int year=1;
    double ben=10000.0,rate1=0.1,rate2=0.05,sum1,sum2;
    while(1)
    {
    sum1=ben*(1+rate1*year);
    sum2=ben*pow((1+rate2),year);
      if(sum2>sum1)
      {
            break;
      }
      year++;
    }
    printf("%d年后黑夜超过小甲鱼!\n",year);
    printf("小甲鱼资产:%.2llf\n",sum1);
    printf("黑夜资产:%.2llf\n",sum2);
    return 0;
}
1.0
#include"stdio.h"
#include"math.h"
int main()
{
    int year=1;
    double sum,rate,expense;
    sum=5000000.0;
    rate=8.0/100;
    expense=500000.0;
    while(1)
    {
      sum=sum*pow((1+rate),year);
      sum-=expense;
      if(sum<0)
      {
            break;
      }
      year++;
    }
    printf("%d年后败光家产!\n",year);
    return 0;
}
2.0
#include<stdio.h>
#include<math.h>
int main()
{
    int i,j;
    float sum=0,t;
    for(i=1,j=0;1;i=i+2,j++)
    {
      //t=pow(-1,j)*(1.0/i);
      sum=sum+pow(-1,j)*(1.0/i);
      if(fabs((1.0/i)-(1.0/i-2))<pow(10,-8))
         {
               break;
         }
    }
    printf("%d    pi= %f\n",i,4*sum);
}

beyaso 发表于 2020-6-20 16:20:27

{:10_333:}

puxizhi 发表于 2020-6-20 20:45:25

0 100
1 10
2 a
3 14 4 4
4 z=x>0?x:-x
5 if(size>12)
{   
    cost = cost *1.05;
    flag = a;
}

bill = cost * flag;


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

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

0
#include<stdio.h>

int main()
{
        float c=0, a=10000,b=10000,d,e,f;

        while(1)
        {
                d=a*10/100;
                c=c+d;
               
                e=b+b*5/100;
                b=e;

                if (b>a+c)
                {
                        break;
                }
        }

        printf("%.2f\n",a+c);
        printf("%.2f\n",b);

        return 0;
}
1
#include<stdio.h>

int main()
{
        float b=4000000,d,e;
        int f=0;

        while(1)
        {
       
               
                e=(b-500000)+(b-500000)*8/100;
                b=e;
                f++;

                if (b<=0)
                {
                        break;
                }
        }


        printf("%d年之后,败光家产.......\n",f);

        return 0;
}
2
#include<stdio.h>

int main()
{
        long double a=1.00000,b,d=1.000000;
        int c=3,i=1;

        for(int count=1000000000;count > 0;count--)
        {
                b = a- (d/c *1/i);
                a = b;
                i = -i;
                c = c+2;

        }
        printf("%.8Lf\n",4*a);

        return 0;
}
3
#include<stdio.h>

int main()
{
        int a=1,b=1,c;

        //unsigned long long d=0;


        //printf("%d\n",b);
        //printf("%d\n",b);
       
        for(int d=3;d<=24;d++)
        {
                c=a+b;
                a=b;
                b=c;


                //printf("%d\n",c);
        }

        printf("%d\n",c);

        return 0;

}

shier 发表于 2020-6-20 22:46:01

111

萌新爱学习 发表于 2020-6-21 20:52:49

0. 100
1. 11
2. c = 5 b = c a =b
3. b = 3 c = 9 a = 4
4. z = fabs(x)

#include<stdio.h>

int main(){
    /*
    double money = 4000000;
    double p = 0.08;
    int i = 0;
    while(money>=0){
      money = money - 500000;
      money = money * (1+p);
      i++;
    }
    printf("%d年后,小甲鱼败光了所有的家产",i);*/
    int num = 2;
    int i = 0;
    for(i==0;i<=24;i++){
      if(i%2==0){
            printf("%i,%d\n",i,num);
            num = num * 2;
      }else{
         printf("%i,%d\n",i,num);
            
      }
    }
    printf("%d",num);
}

5678asd 发表于 2020-6-22 12:44:51

2333

BIGBUTTER 发表于 2020-6-22 16:00:00

0:10个
1:10个
2:c
3:a == 10 , b == 10 , c == 4;
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
{
                sheds = 2;
                help = 2 * sheds;
}
C:
while ((scanf("%d", &score))< 0)
{
      printf("count = %d\n", count);

                count++;
}


研发部的小黄 发表于 2020-6-22 16:06:13

本帖最后由 研发部的小黄 于 2020-6-22 16:11 编辑

0、10个A
1、0个B
2、a/b/c
3、A=14、B=5、C=9
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;
         help = 2 * sheds;
}
sheds = 2;
help = 2 * sheds;

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

JackZzz 发表于 2020-6-22 21:34:16

{:5_90:}

Miracle宸翰 发表于 2020-6-22 21:51:01

啊这

WDYWSZGQD 发表于 2020-6-22 23:07:41

1

LVX123 发表于 2020-6-23 11:55:17

感谢分享

lemonLo_oL 发表于 2020-6-23 17:19:30

2

mikisayaka 发表于 2020-6-24 13:57:47

1

巴巴鲁 发表于 2020-6-24 15:56:48

打卡

依风入海 发表于 2020-6-25 09:48:27

看看
页: 102 103 104 105 106 107 108 109 110 111 [112] 113 114 115 116 117 118 119 120 121
查看完整版本: S1E16:拾遗 | 课后测试题及答案