学习
测试题:
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;
}
nb
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);
参考答案
1
答案
答案
妙啊
1
1
我觉得很有趣!
#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;
}
12312312312
25
1
对答案啦
兔子什么鬼
KK
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++;
}
1