海明
发表于 2019-9-13 14:27:25
学习
在东边
发表于 2019-9-13 20:29:48
测试题:
0. 10 个
1. 0 个
2. a,b,c
3. a:14,b:5,c:9
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.scanf("%d", &score);
while (score >= 0)
{
count++;
scanf("%d", &score);
}
printf("count = %d\n", count);
动动手:
0. #include <stdio.h>
#define INTEREST1 0.1
#define INTEREST2 0.05
int main()
{
double m1 = 10000;
double m2 = 10000;
int year = 0;
while (m1 >= m2)
{
m1 += 10000 * INTEREST1;
m2 *= (1 + INTEREST2);
year++;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n", year);
printf("小甲鱼的投资额是:%.2f\n", m1);
printf("黑夜的投资额是:%.2f\n", m2);
return 0;
}
1. #include <stdio.h>
int main()
{
float money = 4000000;
int year = 0;
while (money > 0)
{
year++;
money -= 500000;
money *= 1.08;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗……\n", year);
return 0;
}
2. #include <stdio.h>
#include <math.h>
int main()
{
double temp = 0;
int denominator = 1;// 分母
double each = 1 / denominator;
while (fabs(each) >= pow(10, -8))
{
temp += each;
denominator += 2;
each = 1 / (float)denominator;
if (denominator % 4 == 3)
{
each = -each;
}
}
printf("精确到小数点后 7 位的圆周率为:%.7f\n", 4 * temp);
return 0;
}
3. #include <stdio.h>
int main()
{
int time;
int a = 1, b = 1, temp;
for (time = 0; time < 24 - 1; time++)
{
temp = a;
a = b;
b = temp + b;
}
printf("两年之后可以繁殖%d对兔子\n", a);
return 0;
}
wwawda
发表于 2019-9-14 14:20:40
nb
Candy.
发表于 2019-9-14 15:05:12
0. 10个
1. 0个
2. 5
3. a=14;b=5;c=9
4. if (x<0)
{
x = x * -1;
z = 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);
Amin.
发表于 2019-9-14 16:07:17
参考答案
qq2222112264
发表于 2019-9-14 16:49:00
1
1412342464
发表于 2019-9-15 17:34:13
答案
御坂10046
发表于 2019-9-16 00:18:51
答案
xztzz
发表于 2019-9-16 14:35:33
妙啊
XZL777
发表于 2019-9-16 18:12:33
1
ttf10
发表于 2019-9-16 19:14:06
1
XZL777
发表于 2019-9-16 23:38:21
我觉得很有趣!
#include <stdio.h>
int main()
{
int d,c;
double a=4000000,b;
printf("小甲鱼每年花了多少钱?");
scanf("%d",&c);
for(;a>=0;)
{
a=a-c;
b=a*0.08;
a=a+b;
printf("%.2f\n",a);
d++;
if(a>=8000000)
{
printf("小甲鱼勤俭持家结果过了%d年后资产翻了一番......",d);
goto xu;
}
}
printf("小甲鱼乱花钱结果%d年后破产了...",d);
xu: ;
return 0;
}
837188733
发表于 2019-9-17 17:55:41
12312312312
sagara
发表于 2019-9-17 17:59:56
25
a1053828045
发表于 2019-9-17 18:27:28
1
ALIEN_NoT
发表于 2019-9-18 15:19:56
对答案啦
S1104
发表于 2019-9-19 11:06:39
兔子什么鬼
1480589612
发表于 2019-9-20 10:38:51
KK
现实如梦如幻
发表于 2019-9-20 19:35:18
100
11
a = 15b = 5 c = 10
z = (x >= 0 ? x , x = -x)
5:
A: if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
else
{
bill = cost * flag;
}
B:
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C:
readin: scanf("%d", &score);
while (score < 0)
{
printf("count = %d\n", count);
count++;
}
JonathanLou
发表于 2019-9-21 11:35:59
1