来了!!!{:5_105:}
1
0.100次;
1.10次;
2.a,b,c;
3.a=14,b=5,c=9;
4.x>=0? z=x: z=-x;
5. A .if(size > 12)
{
cost* = 1.05;
flag= 2;
}
else
{
bill= cost*flag;
}
B.If(ibex > 14)
{
sheds = 3;
}
else
{
sheds =2;
help = 2*sheds;
}
C.
scanf(“%d”,&score);
while( getchar()>=0)
{
count++;
}
printf(“count = %d\n”,count);
0.81
1.打印11个B
2.a = 5, b = 5, c =5;
3.b = 3;c = 8; a = 12;
4.
5.
答案
1
看看答案
#include <stdio.h>
#include <math.h>
int main()
{
//0比较投资额
/*
float x, h;
int y = 0;
x = h = 10000;
while (x >= h)
{
x = 10000 * 0.1 * y + 10000;
h = 10000 * pow((1 + 0.05), y);
y++;
}
printf("%d年后,黑夜的投资额超过了小甲鱼!\n", (y-1));//注意这里是y-1
printf("小甲鱼的投资额是:%.2f\n", x);
printf("黑夜的投资额是:%.2f\n", h);
*/
//1.败光家产
/*
float x = 4000000;
int year = 1;
while (x > 0)
{
x = (x - 500000) * (1 + 0.08);
year++;
}
printf("%d年之后, 小甲鱼败光了所有的家产,再次回到一贫如洗....\n", (year - 1));
*/
//2.求Pi
/*
double Pi = 0, n = 1, m;
int i = 0;
while (1)
{
m = 1/n * pow(-1, i);
if (fabs(m) < 0.00000001)
{
break;
}
Pi += m;
i++;
n += 2;
}
printf("Pi = %.7f\n", (Pi * 4));
*/
//3.兔子繁殖
int i, n = 2;
for (i = 2; i <= 24; i++)
{
n = n + 2 * (n/2);
}
printf("两年后可以繁殖%d对兔子\n",(n/2));//多少对n/2
printf("2 ^ 24 = %.2f\n", pow(2, 23));//pow函数返回的是浮点型!
}
加油
测试题第1题(不是第0题)好坑,自信满满的以为会有11个B结果啥都没有
答案
动动手第一题也可以用for循环https://z3.ax1x.com/2021/10/16/5GqAZ8.png
学得脑壳疼
灬
{:5_90:}
6
kk
👌
1
{:5_102:}