|
发表于 2022-4-12 13:16:48
|
显示全部楼层
0. 10次
1. 10个B
2. a
3. a = 15, b = 4, 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. done
#include <stdio.h>
#include <math.h>
int main()
{
int year;
float benjin = 10000.00;
float x, y;
float x_interest;
float y_interest;
float x_rate = 0.10, y_rate = 0.05;
x = 10000.00, y = 10000.00;
for (year = 0; x >= y; year ++)
{
x = benjin + (benjin * x_rate) * year;
y = benjin * pow((1+y_rate), year);
if (y > x)
{
break;
}
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n", year);
printf("小甲鱼的投资额是:%.2f\n", x);
printf("黑夜的投资额是:%.2f\n", y);
return 0;
}
1. not sure why dead circle...
#include <stdio.h>
#include <math.h>
int main()
{
int year;
double prize = 4000000.00;
double expense = 500000.00;
double rate = 0.08;
for (year = 0; prize > 0; year ++)
{
prize = prize - expense;
if (prize <= 0)
{
break;
}
else
{
prize = prize * pow((1+rate), year);
}
}
printf("%d年后小甲鱼败光了所有的家产,再次回到一贫如洗。\n", year);
return 0;
}
2. will do
3. will do |
|