|
发表于 2024-1-16 22:48:24
|
显示全部楼层
0.10
1.10
2.a,b,c
3.a=14
b=5
c=9
4.x>=0?z=x:z=-x;
5.
0.#include <stdio.h>
#include <math.h>
int main()
{
int year=0;
double a=0, b=0;
while (b <= a)
{
year++;
a = 10000 * 0.1*year+10000;
b = 10000 * pow(1.05, year);
}
printf("%d\n", year);
printf("%f\n", a);
printf("%f", b);
return 0;
}
1.#include <stdio.h>
#include <math.h>
int main()
{
int year;
double num = 1.00;
for (year = 1; num > 0;)
{
num = (4000000 - 500000) * pow(1.08, year) - 500000* ((1.08 - pow(1.08, year + 1)) / (1 - 1.08));
year++
}
printf("%d", year);
return 0;
}
2.#include <stdio.h>
#include <math.h>
int main()
{
int year;
double num = 1.00,a=1.00;
for (year =1.; ; year++)
{
num = fabs(1 / (pow(2, year) + 1));
if (num < 0.00000001)
break;
a = a + 1 / ((pow(2, year) + 1) * pow(-1, year));
}
printf("%lf", 4*a);
return 0;
}
3. |
|