|
发表于 2023-7-9 22:31:35
|
显示全部楼层
0.10
1.10
2.a,b,c
3.14,5,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;
}
else
{
sheds = 2;
}
help = 2 * sheds;
C
while(score >= 0)
{
count++;
scanf("%d", &score);
}
printf("count = %d\n", count);
0.
#include <stdio.h>
int main()
{
double xjy = 10000,hy = 10000;
int year = 0;
while(xjy >= hy)
{
year++;
xjy = xjy + 10000 * 0.1;
hy = hy * 1.05;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n",year);
printf("小甲鱼的投资额是:%.2f\n",xjy);
printf("黑夜的投资额是:%.2f\n",hy);
return 0;
}
1.
#include <stdio.h>
int main()
{
int year = 0;
double money = 4000000;
while(money > 0)
{
money = (money - 500000) * 1.08;
year++;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n",year);
return 0;
}
2.
#include <stdio.h>
#include <math.h>
int main()
{
double i = 1,pi = 0,j = 3;
while(fabs(i) > (10^(-8)))
{
pi += i;
i = -i / j;
j += 2;
}
printf("%f",pi * 4);
return 0;
}
3.
|
|