scanf^wtlt 发表于 2019-5-29 15:49:56

+++

shenfeng 发表于 2019-5-29 23:19:28

{:10_282:}

1003826976 发表于 2019-5-31 14:58:52

11111111111111

Bingohan 发表于 2019-5-31 20:36:44

输入实数,输出实数绝对值

#include <stdio.h>

int main()
{
        while (1)
        {
                float x;    //输入
                float z;        //输出
                printf("请输入x的值:");
                scanf_s("%f", &x);

                if (x < 0)
                {
                        z = -x;
                }
                else
                {
                        z = x;
                }
                printf("%.2f的绝对值为:%.2f\n", x,z);
                putchar('\n');
        }

        return 0;

}

Bingohan 发表于 2019-5-31 20:57:21

A:
if (x > 12)
{
        cost *= 1.05;
        flag = 2;
}
else
{
        bill = cost * flag;
}


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


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

BigStrong 发表于 2019-5-31 22:07:03

学习

15135785128 发表于 2019-6-2 15:49:47

setsrtst

Bingohan 发表于 2019-6-2 19:22:22

#include <stdio.h>

#define danlixi0.1    //小甲鱼存款模式 单利息 利率10%
#define fuhelixi 0.05   //黑夜存款模式,单利息 利率5%

int main()
{
        int i=1;            //存储年份
        double sum_1 = 0;   //存储小甲鱼的本加息
        double sum_2 = 0;   //存储黑夜模式的本加息
        double benjin;

        while (sum_1 >= sum_2)
        {       
                i++;
                benjin = 10000;
       
                sum_1 =i * benjin * danlixi + benjin;

                for (int k = 1; k <= i; k++)
                {
                        sum_2 = benjin = benjin * 0.05 + benjin;
                }
               
               
        }

        printf("存入%d年后,小甲鱼本息和为%.2f\n", i, sum_1);
        printf("存入%d年后,黑夜的本息和为%.2f\n", i, sum_2);

        return 0;
       
}

Mumun 发表于 2019-6-3 10:47:38

l

justjust001 发表于 2019-6-3 23:22:44

打卡学习

sakuraslor 发表于 2019-6-5 17:22:07

1

a494006257 发表于 2019-6-7 18:20:26

0.10次,因为只有内循环有打印A外循环没有告诉需要打印A。
1.11次
2.a,b,c
3.a = 15, b = 9, c = 4
4. z = x + -x == 0 ?z : x
5.

Kagari 发表于 2019-6-8 15:29:47

0.
10
1.
0
2.
a b c
3.
c=9 b=5 a=14

4.if (x<0 && 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.
while score > 0
      scanf("%d", &score);
      count++;
printf("count = %d\n", count);


0.
if xiao < chu
xiao += xiao_init*1.1
chu = chu*1.05
year++

1.
#include<stdio.h>

#include<stdio.h>

int main()
{
        int money = 400*1000,count=0;
       
        while (money >= 0)
        {
                money -=50*1000;               
                money = money*1.08;

                count ++;
       }
       printf("%d",count);
       return 0;
}
2.
#include<stdio.h>
#include<math.h>
int main()
{
        float i,pi=0,fuhao=1;
        for (i=0;fabs(1/(2*i+1)) > 0.0000001;i++)
        {
               pi+=(1/(2*i+1))*fuhao;
                fuhao=-fuhao;
        }
        printf("%f",pi*4);
}

Lanckie 发表于 2019-6-8 15:50:08

feibonaqi太难了

lianl 发表于 2019-6-9 09:24:45

{:10_257:}{:10_257

JulyJoker 发表于 2019-6-10 14:41:29

{:10_277:}

newnhoj 发表于 2019-6-11 17:44:52

kandanaanna l

453022113 发表于 2019-6-12 13:49:38

1111

Rookie很菜鸟 发表于 2019-6-13 09:03:52

...

克里斯保罗 发表于 2019-6-13 12:42:46

0.100
1.10
2.c
3.a = 3 ,c = 9 , b = 5
4.z = x<0?-x:x
5.if (size > 12)
{
        cost = cost * 1.05;
        flag = 2;
        bill = cost * flag;
}

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


if(score < 0)
{
        printf("count = %d\n",count);
}
else
{
        count ++
        scanf("%d",&score);
}
页: 39 40 41 42 43 44 45 46 47 48 [49] 50 51 52 53 54 55 56 57 58
查看完整版本: S1E16:拾遗 | 课后测试题及答案