|
发表于 2016-5-11 17:15:42
|
显示全部楼层
0.10个A
1.0个
2.c = 5
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)if (score < 0)
{
printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
0.#include<stdio.h>
#include<math.h>
int main()
{
float x,y;
int t = 1;
x = 11000;
y = 10500;
while(x > y)
{
x = 11000 + 1000 * t;
y = y * 1.05;
t++;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n",t);
printf("小甲鱼的投资额是:%.2f\n",x);
printf("黑夜的投资额是:%.2f\n",y);
return 0;
}
1.#include<stdio.h>
int main()
{
float x;
int t = 1;
x = 400;
while(x > 50)
{
x = (x - 50) * 1.08;
t++;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......",t);
return 0;
}
2.#include<stdio.h>
#include<math.h>
int main()
{
double i,s,a,sum = 1;
i = 1;
s = 1;
a = 1;
while(fabs(a) >= pow(10,-8))
{
i = i + 2;
s = - s;
a = s * (1 / i);
sum = sum + a;
}
sum = sum - a;
printf("pi的值为:%.7f",sum * 4);
return 0;
}
3.#include<stdio.h>
#include<math.h>
int main()
{
int n = 3,i = 2;
int t;
for(t = 4;t <= 24;t++)
{
n = n + i;
i = i + 1;
}
printf("两年之后可以繁殖%d对兔子",n);
return 0;
} |
|