Nakedsolid 发表于 2023-11-26 13:06:47

111

2469735245 发表于 2023-11-27 15:41:21

鱼C有你更精彩^_^

臭美小辣椒 发表于 2023-11-28 17:01:00

0:10个
1:0个
2:a=5
3:a=15、b=5、c=10
4: x = x<=0?x*-1:x;
5:
A:if (size > 12)
{
      cost = cost * 1.05;
}
else{
bill = cost * flag;
}
B:if (ibex > 14)
{
      sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C:while(count)
{
readin: scanf("%d", &score);
if (score < 0)
{
      printf("count = %d\n", count);
}
count++;
}

臭美小辣椒 发表于 2023-11-29 10:25:23


发现评论区就我发截图{:10_259:}

珍藏 发表于 2023-11-30 09:01:21

1

dot_35 发表于 2023-12-2 17:04:10

17:04

spiritgan9 发表于 2023-12-2 23:04:46

学习打卡

headache 发表于 2023-12-3 00:54:31

支持

ilovebiancheng 发表于 2023-12-3 19:19:51

/*这是一个有趣的古典数学问题:如果说兔子在出生两个月后,就有繁殖能力,
在拥有繁殖能力之后,这对兔子每个月能生出一对小兔子来。
假设所有兔子都不会死去,能够一直干下去,那么两年之后可以繁殖多少对兔子呢?*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int gaici,i;
    int sum;
    int a=1;//当前兔子对数
    int b=1;//当前可以繁殖的兔子对数

    for(gaici=1,i=0;gaici<=24;gaici++,i++)
    {
            if (i%2==0&&i!=0)
            {
                b=b+1;
            }
      a=a+b;
      
    printf("第%d月,共有%d对兔子,其中%d对兔子可以繁殖\n",gaici,a,b);

    }


    system("pause");
    return 0;
}

haruno87 发表于 2023-12-3 21:18:12

1

顾冷985 发表于 2023-12-5 08:03:51

那么

芒果益菌多 发表于 2023-12-6 13:16:24

6

笨比小马 发表于 2023-12-6 22:33:04

{:5_90:}

あ幻月 发表于 2023-12-7 09:37:35

0. 10个
1.10
2.a
3.5610
4.#include<stdio.h>
int main()
{
        int x;
        scanf("%d",&x);
        x>0? x = x:x = -1*x;
        printf("%d\n",x);
        return 0;
}
5.
Aif (size > 12)
{
      cost = cost * 1.05;
      flag = 2;
}
else
{
          bill = cost * flag;
}
Bif (ibex > 14)
{
      sheds = 3;
}
sheds = 2;

   else
   {
       help = 2 * sheds;
       }
   
C
while(1)
{
       
if (score < 0)
{
      printf("count = %d\n", count);
}
count++;
}
0.#include<stdio.h>
#include<math.h>
int main()
{
        int xjy_money ;
        int heiye_money;
        int year = 1;
        while(heiye_money<xjy_money)
        {
                xjy_money = 10000 + 1000*year;
                heiye_money = 10000*pow(1.05,year);
                year++;
        }
        printf("%d年后,黑夜的投资额超过小甲鱼!\n");
        printf("小甲鱼的投资额是:%.2f\n",xjy_money);
        printf("黑夜的投资额是:%.2f\n",heiye_money);
        return 0;
}
1.#include<stdio.h>
int main()
{
        float total_money = 400;
        int year = 0;
        while(total_money>=0)
        {
                total_money -=50;
                total_money = total_money*1.08;
                year++;
        }
        printf("%d",year);
        return 0;
}
2.#include<stdio.h>
#include<math.h>
int main()
{
        double pi = 0;
        double i;
        int count = 0;
        for(i = 1;1/i>=0.00000001;i+=2)
        {
                int singal = pow(-1,count);
                pi = pi + singal*(1/i);
                count++;
        }
        pi = 4*pi;
        printf("%.7f\n",pi);       
        return 0;
}
3.

滑小稽丶 发表于 2023-12-7 19:51:36

20231017 发表于 2023-12-9 12:29:57

测试题
0:100个A
1:1个B
2:a
3:a=11,b=3,c=8
4:if(x>0)
{
z=x;
}
else
{
z=-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:readin: scanf("%d", &score);
if (score < 0)
{
      printf("count = %d\n", count);
}
else
{
count++;
scanf("%d", &score);
}


动动手
0:
#include <stdio.h>

int main() {
    float xiaojiafish = 10000;// 小甲鱼手上的钱
    float heiye = 10000;// 黑夜手上的钱
    float xiaojiafish_interest, heiye_interest = 0;// 利息

    int year = 0;

    while (xiaojiafish >= heiye) {
      xiaojiafish_interest = xiaojiafish * 0.1;// 计算小甲鱼的单利息
      xiaojiafish += xiaojiafish_interest;// 更新小甲鱼的总投资额

      heiye_interest = heiye * 0.05;// 计算黑夜的复合利息
      heiye += heiye_interest;// 更新黑夜的总投资额

      year++;// 年数加一
    }

    printf("经过 %d 年,黑夜的投资额 %f 超过了小甲鱼的投资额 %f\n", year, heiye, xiaojiafish);

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

int main()
{
   float a;
   a = 400;
   float b;
   b = 0;
   int year;
   while(a >= 0)
   {
       b = a * 0.08;
       a += b;
       a = a - 50;
       year++;
   }
   printf("经过 %d 年,小甲鱼败光属于家产,再次回到一贫如洗\n",year);
    return 0;
}
2:
#include <stdio.h>
#include <math.h>

int main() {
    double pi = 0.0;
    double item = 1.0;
    int i = 1;

    while (fabs(item) >= 1e-8) {
      pi += item;
      i = -i;
      item = 1.0 / (2 * i + 1);
    }

    pi *= 4;

    printf("π 的近似值为: %.7f\n", pi);

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

int main() {
    double pi = 0.0;
    double item = 1.0;
    int i = 1;

    while (fabs(item) >= 1e-8) {
      pi += item;
      i = -i;
      item = 1.0 / (2 * i + 1);
    }

    pi *= 4;

    printf("π 的近似值为: %.7f\n", pi);

    return 0;
}

KKKK2525 发表于 2023-12-9 21:23:02

22

张婉卿 发表于 2023-12-10 20:39:53

朕想知道

纪叶 发表于 2023-12-11 20:59:06

本帖最后由 纪叶 于 2023-12-11 22:13 编辑

0. 10个

1.11个

2. a b c

3.a = 3,b = 4,c = 14,

4.z = x > 0 ?x : -x;

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

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

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


0.
#include <stdio.h>

int main()
{
        float fish = 10000.00, blacksky = 10000.00;
        int year = 0;
       
        while (blacksky <= fish)
        {
                fish = fish + 10000.00*0.1;
                blacksky = blacksky *(1 + 0.05);
                year++;
        }
       
        printf("%d年后,黑夜的投资额超过小甲鱼!\n",year);
        printf("小甲鱼的投资额是:%.2f\n",fish);
        printf("黑夜的投资额是:%.2f\n",blacksky);
       
        return 0;
}

1.
#include <stdio.h>

int main()
{
        float touzi = 400.00;
        int year = 0;
       
        while(touzi >= 0)
        {
                touzi = touzi - 50;
                touzi += touzi*0.08;
                year++;
        }
       
        printf("%d年后,小甲鱼败光了所有的家产,再次回到一贫如洗...",year);
       
        return 0;
}

2.


xxx158158 发表于 2023-12-13 15:43:40

朕想知道
页: 261 262 263 264 265 266 267 268 269 270 [271] 272 273 274 275 276 277 278 279 280
查看完整版本: S1E16:拾遗 | 课后测试题及答案