|
发表于 2020-8-9 20:32:02
|
显示全部楼层
0.10个A
1.10个B
2.a,b,c
3.a = 11,b = 5,c = 9
4.z = x>0 ? x:-x
5.- if(size>12)
- {
- const = const * 1.05;
- flag = 2;
- }
- else
- {
- bill = cost * flag;
- }
复制代码- if(ibex>14)
- {
- sheds = 3;
- help = 2 * sheds;
- }
- else
- {
- sheds = 2;
- help = 2*sheds;
- }
复制代码- do
- {
- scanf("%d",&score);
- if(score<0)
- {
- printf("count = %d\n",count);
- }
- else
- {
- count++;
- scanf("%d",&score);
- }
- }while(score<0);
复制代码
动动手
0.- #include<stdio.h>
- int main()
- {
- float money1 = 10000.0,money2 = 10000.0,jiayu,heiye;
- float rate1 = 0.1,rate2 = 0.05;
- int year = 0;
- jiayu = money1;
- heiye = money2;
- do
- {
- jiayu = jiayu + money1 * rate1;
- heiye = heiye + heiye * rate2;
- year++;
- }while(heiye<=jiayu);
-
- printf("%d年后,黑夜的投资超过小甲鱼!\n",year);
- printf("小甲鱼的投资额是:%.2f\n",jiayu);
- printf("黑夜的投资额是:%.2f\n",heiye);
- return 0;
- }
复制代码
1.- #include<stdio.h>
- int main()
- {
- float all = 4000000.0;
- float rate = 0.08;
- float spending = 500000.0;
- int year = 0;
- do
- {
- all = all - spending;
- all = all + all*rate;
-
- year++;
-
- }while(all>0);
-
- printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n",year);
-
- return 0;
- }
复制代码
2.- #include <stdio.h>
- int main()
- {
- int i = 1,j;
- float x,sum = 0;
- for(j = 1; 1.0/j>pow(10,-6);j = j + 2)
- {
- sum = sum + i*(1.0/j);
- i = -i;
- }
- x = sum * 4;
-
- printf("圆周率为:%.7f\n",x);
-
- return 0;
- }
复制代码
3.- #include<stdio.h>
- int main()
- {
- int rubbits = 2;
- int i;
- int year = 2;
-
- for(i = 0;i <= year*12; i = i+2)
- {
- rubbits *= 2;
- }
-
- printf("%d年后,可以繁殖%d对兔子!\n",year,rubbits/2-1);
-
- return 0;
- }
复制代码 |
|