creamsky
发表于 2021-7-24 18:45:42
S1E16:拾遗 | 课后测试题及答案 [修改
鱼C最帅
发表于 2021-7-25 10:16:01
1
扶疏碎琼半痕雪
发表于 2021-7-25 13:18:08
做完啦,对个答案案{:10_279:}
憨憨is
发表于 2021-7-25 14:29:35
冲鸭
焦糖橙子
发表于 2021-7-25 19:14:36
本帖最后由 焦糖橙子 于 2021-7-25 19:37 编辑
#include<stdio.h>
#include <math.h>
int Q1()
{
int i, j = 0;
for (i = 0; i != 10, j != 10; i++)
{
for (j = 0; j < 10; j++)
{
putchar('A');
}
}
putchar('\n');
return 0;
}
/*
a 14
b 3 4 5
c 8 9
*/
int Q4()
{
double x, z;
printf("请输入一个数:");
scanf("%lf", &x);
z = x > 0 ? x : (-x);
printf("z的值为:%f\n", z);
return 0;
}
int QQ0()
{
float interst = 0.1, interst_d = 0.05;
float a = 10000, b = 10000, sum_a = a, sum_b = b;
int year = 1;
do
{
sum_a = sum_a +a *interst * year;
sum_b = sum_b * (1 +interst_d);
year++;
} while (sum_a > sum_b);
printf("%d年后,黑夜的投资额超过小甲鱼!\n",year);
printf("小甲鱼的投资额是:%.2f\n", sum_a);
printf("黑夜的投资额是:%.2f\n", sum_b);
return 0;
}
int QQ1()//天降横财
{
float a = 4000000;
int year = 0;
do
{
a = a + a * 0.08;
a = a - 500000;
year++;
} while (a > 0);
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n", year);
return 0;
}
int QQ2()//计算PI的小数点后前7位
{
double i = 1, j = 1;
double PI = 0;
while (fabs(1 / j > pow(10, -8)))
{
PI = PI + (i / j);
i = -i;
j = j + 2;
}
PI = PI * 4;
printf("PI的值约为%.7f\n", PI);
return 0;
}
int QQ3()//兔子繁殖问题
{
int i, j ;
double k = 0;
i = 2;
for (j = 0; j <= 12; j++)
{
k = pow(i, j);
}
printf("两年之后可以繁殖%.0f对兔子。\n", k);
return 0;
}
兔子那题没看懂,我去查查资料。
小白织
发表于 2021-7-25 21:00:23
dge
波拉
发表于 2021-7-25 21:59:58
1
炎大刀
发表于 2021-7-26 09:01:55
1
douqiangdxz
发表于 2021-7-26 09:25:42
查看参考答案
晏宇轩
发表于 2021-7-26 14:02:17
加油
1244341380
发表于 2021-7-26 22:36:13
66
Kinesis
发表于 2021-7-27 11:52:26
0.100个
1.11个
2.ab c
3.a = 3 b = 5 c = 9
4.z = x >= 0 ? x : -x
5.
A.
if (size > 12)
{
cost *= 1.05;
flag = 2;
}
bill = cost * flag
B.
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C.
zhk474563042
发表于 2021-7-27 23:46:19
{:5_90:}
dahaoshanhe
发表于 2021-7-28 15:39:20
l
wshwx
发表于 2021-7-28 20:41:30
0
Lily20020104
发表于 2021-7-29 15:41:01
0.#include <stdio.h>
#define MONEY 10000
int main()
{
double a_total = MONEY, b_total = MONEY;
int count = 0;
do
{
a_total += MONEY * 0.1;
b_total += b_total * 0.05;
count++;
} while(a_total >= b_total);
printf("%d年后,黑夜的投资额超过小甲鱼!\n", count);
printf("小甲鱼的投资额是:%.2f\n", a_total);
printf("黑夜的投资额是:%.2f\n", b_total);
return 0;
}
1.
#include <stdio.h>
int main()
{
double awards = 4000000;
int count = 0;
while (awards >= 0)
{
awards -= 500000;
awards += awards * 0.08;
count++;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗……\n", count);
return 0;
}
2.#include<stdio.h>
int main(){
int term,denominator;//项数 ,分母
float sign=1.0;//分子
float pi = 0.0;
for(term=0;term<700000;term++){
denominator=2*term+1;//这里面表示奇数项
pi = pi+(sign/denominator);
sign = -sign;
}
pi = pi*4.0;
printf("pi的近似值为%10.7f",pi);
}
3.
leileis6
发表于 2021-7-29 20:11:31
1
回望再无原风景
发表于 2021-7-29 20:11:33
0.100
1.11
2.
3.a=14;b=5;c=9
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.
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
Allen0711
发表于 2021-7-29 22:57:48
3
Emmu
发表于 2021-7-30 16:14:33
感谢