夏目。。 发表于 2020-4-15 16:24:16

11

Caligulasick 发表于 2020-4-15 18:37:13

看看

GODEATER 发表于 2020-4-15 19:17:14

9 314

庐陵萱小落 发表于 2020-4-15 19:18:46

#include<stdio.h>
int main()
{
        int f=10000,count=0;
        float sum1=10000,sum2=10000;
        while(sum2<=sum1)
        {
                sum1=sum1+f*0.1;
                sum2=1.05*sum2;
                count++;
        }
        printf("%d年后,黑夜的投资额超过小甲鱼!\n",count);
        printf("小甲鱼的投资额是:%.2f\n",sum1);
        printf("黑夜的投资额是:%.2f\n",sum2);
       
        return 0;
}

#include<stdio.h>
int main()
{
        int a=4000000,count=0;
        while(a>0)
        {
                a-=500000;
                a=1.08*a;
                count++;
        }
        printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗。",count);
       
        return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
        double a=1,sum=4;
        int count=1;
        while(1)
        {
                a=1/(1+(float)count*2);
                if(a>=pow(10,-8))
                {
                        if((int)count%2!=0)
                        {
                                a=-a;
                                sum+=4*a;
                                a=-a;
                                count++;
                        }
                        else
                        {
                                sum+=4*a;
                                count++;
                        }
                       
                }
                else
                {
                        break;
                }
        }
       
        printf("pi保留7位是%.7lf",sum);
       
        return 0;
}



1835170783 发表于 2020-4-15 23:30:08

0,81
1,0
2,5
3,

你是我的小甲鱼 发表于 2020-4-16 13:23:50

{:10_277:}

寰寰 发表于 2020-4-16 19:34:40

0:10个A
1:11个B
2:a,b,c
3:a=14,b=9,c=5
4:
5:
A:
if (size > 12)
{
      cost = cost * 1.05;
      flag = 2;
}
bill = cost * flag;
B:
if (ibex > 14)
{
    sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C:
while(1)
{
    scanf("%d", &score);
   if (score < 0)
   {
      printf("count = %d\n", count);
      break;
    }
    count++;
}
动动手:
#include<stdio.h>
int main()
{
    float x=10000,b=10000;
    int count=0;
    while(x>=b)
    {
      x+=1000;
      b=b*1.05;
      count++;
    }
    printf("%d年后,黑夜的投资额超越小甲鱼!\n小甲鱼的投资额是:%.2f.\n黑夜的投资额是:%.2f.\n",count,x,b);


}
1:
#include<stdio.h>
int main()
{
    float x=4000000;
    int count=0;
    while(x>0)
    {
      x=(x-500000)*1.08;
      count++;
    }
    printf("%d年后,小甲鱼败光所有家产,再次回到一贫如洗。。。。。\n",count);
}
2:
#include<stdio.h>
#include<math.h>
int main()
{
    double PI=1.0,i=1.0,num=1.0,I;
    int n=0;
    while(fabs(num)>=pow(10,-8))
    {
      if(i>0)
      {
            i=-(i+2);
      }
      else
      {
            i=-(i-2);
      }
      num=1/i;
      PI+=num;
    }
    PI=4*PI;
    printf("PI的值为%.7f\n",PI);

}

小科 发表于 2020-4-16 19:37:33

11

1664805781 发表于 2020-4-18 03:08:25

EvadeRr 发表于 2020-4-19 00:48:09

I LOVEV

瀚之小朋友 发表于 2020-4-19 13:51:12

33444444444555555555666666666666667777888899999999999999999999999000000000000000011

Alexcion 发表于 2020-4-19 16:20:38

0 10
1 0
2 abc
3 14 5 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
{
      sheds = 2;
      help = 2 * sheds;
}   
c
do
{
      scanf("%d", &score);
      if(score<0)
      {
                printf("count = %d\n", count);
      }
      count++;
}while(score>=0);

nicklai0720 发表于 2020-4-19 21:32:34

0. 100個
1. 10
2. a, b, c = 5, 5, 5;
3. a = 14, b = 5, c = 9
4. z = x > o? x : y
5. A:
if (size > 12) {
    cost *= 1.05; break;}
bill = cost * flag;
B:
if (ibex > 14) {
    sheds = 3; }
help = 2 * sheds;
C:
while 1 {
   scanf("%d", &score);
   if (score < 0) {
    printf("count = %d\n", count); break; }}
count++;

lonrenzoz 发表于 2020-4-20 13:46:41

1111111111111

15683000996 发表于 2020-4-20 15:12:17

测试题:
0.10次
1.0次  开始时 while = 0;//为假就不执行了?
2. a, b, c ;   lvalue 是用于识别或定位存储位置的标识符
3.
b=3,c=b+1+5,a = c+1 + b+1;

a == 14; (9+1 + 3+1)
b == 5;   (3+1+1)
c == 4;    (3+1)

5.
A:
if (size > 12)
{
      cost = cost * 1.05;
      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()
{
        double i, xjy, hy;

        for(i=0;hy <= xjy;i++)
        {       
                xjy = hy = 10000;

                xjy += (xjy* 0.1)*i ;//单利率:利息=本金x年利率x年数

                hy = hy*pow((1 + 0.05) ,i);//复利率:F=P*(1+i)^n
        }

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

        return 0;
}

1.
#include <stdio.h>

int main()
{
        double yuan,year;

        yuan = 40000000;

        for (year=0;yuan >= 0;year++)
        {       
                yuan -=5000000;
                yuan += yuan * 0.08;
        }

        printf("%.f年之后,小甲鱼败光了所有家产,再次回到一贫如洗......\n",year);

        return 0;
}

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

int main()
{
        float i=1.0, n=1.0 ,s=1,Pi=0;

        for (;fabs(n) >= 10^(-8); i += 2)
        {
                Pi += n;
                s= -s;

                n = s/i;
               
        }
        Pi = 4*Pi;
        printf("Pi = %.7f",Pi);
        return 0;
}

3.
#include <stdio.h>

int main()
{
        int sum, t=2;

        for(int year=720;year >= 0;year-=60)
        {
                sum = t;
                for (int mother=2;mother >= 0;mother--)
                {
                        t +=2;
                }
                t *= 2;
        }

        printf("%d",sum);

        return 0;
}
57332只兔兔?

山下没亭子 发表于 2020-4-20 16:47:04

1

小鹈鹕 发表于 2020-4-20 19:18:14

1

刘庚鑫 发表于 2020-4-20 20:34:57

0

萌笨笨萌 发表于 2020-4-20 20:53:03

0.        打印100个‘A’;
1.        11
2.        A
3.        a=14,b=4,c=8
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;
}
Sheds =2;
Help = 2*sheds;
C:if(score <0)
{
Printf(“count =%d\n”,count);
}
Count++;
Scanf(“%d”,&score);

6.       

19120758154 发表于 2020-4-20 21:39:52

0.100个
1.11个
2.
3.a=
4.
5.if (size > 12)
{
       cost = cost * 1.05;
      flag = 2;
}
bill = cost * flag;
6.if (ibex > 14)
{
      sheds = 3;
}
sheds = 2;
help = 2 * sheds;
7.readin: scanf("%d", &score);
if (score < 0)
{
      printf("count = %d\n", count);
}
count++;
goto    readin;
7.
页: 91 92 93 94 95 96 97 98 99 100 [101] 102 103 104 105 106 107 108 109 110
查看完整版本: S1E16:拾遗 | 课后测试题及答案