1
0.81个
1.9个
2.a
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:
f
i
0.10
1.0
2.a,b,c
3.a=14,b=5,c=9
4.#include <stdio.h>
int main()
{
float x, z;
printf("请输入x:");
scanf("%f", &x);
if (x >= 0)
{
z = x;
}
else
{
z = -x;
}
printf("x的绝对值是:%f\n", z);
return 0;
}
5.A.if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
B.if (ibex > 14)
{
sheds = 3;
}
else
{
Cwhile (1)
{
scanf("%d", &score);
if (score < 0)
{
break;
}
else
count++;
}
printf("count = %d\n", count);
0.#include <stdio.h>
int main()
{
floatb, suma;//suma为小甲鱼,b为黑夜
int count = 0;
b = 10000;
do
{
b = b * (1 + 0.05);
count++;
suma = 10000 * count * 0.1 + 10000;
} while (suma > b);
;
printf("%d年后,黑夜的投资额超过小甲鱼!\n", count);
printf("小甲鱼的投资额是:%.2f\n", suma);
printf("黑夜的投资额是:%.2f\n", b);
return 0;
}
1.#include <stdio.h>
int main()
{
double sum = 4000000;
int count = 0;
while (sum >= 0)
{
sum = sum - 500000;
sum = sum * (1 + 0.08);
count++;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n", count);
return 0;
}
2.#include <stdio.h>
#include <math.h>
int main()
{
int count = -1;
int m = 1;
double a = 0;
int i = 1;
double sum = 0;
double c = pow ( 10, -8);
do
{
a = 1.0 / m *i;
sum = sum + a;
m = m + 2;
i = -i;
} while (fabs(a) > c);
printf("PI/4 = %.7f", sum);
return 0;
}
3.不会
1
0.81
1.11
2.a
3. a=14 b=4 c=8
1
{:5_111:}
1
0.10
1.
3.a=14,b=5,c=9
4.z=x>-x?x:-x
5,
9 10
0. 10个
1. 0个
2. c = 5; b = c; a = b
3. a = 13; b = 3; c = 8;
4. z = x > 0 ? x : -x
5. A.
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
5. B.
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
5. C.
readin: scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
readin: scanf("%d", &score);
1.
#include <stdio.h>
int main()
{
int year = 0;
double money = 4000000;
double i = 0.08;
while (money > 0)
{
year++;
money -= 500000;
if (money > 0)
{
money *= (1 + i);
}
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗……", year);
return 0;
}
2.
#include <stdio.h>
#include <math.h>
int main()
{
double pi, i, sum, deno, sign;
sum = 0;
deno = 1;
sign = 1;
while (1)
{
i = sign / deno;
if (fabs(i) < pow(10, -8))
{
break;
}
sum += i;
deno += 2;
sign = -sign;
}
pi = sum * 4;
printf("pi = %.7f\n", pi);
return 0;
}
3.
#include <stdio.h>
int main()
{
int i, a, b, c;
for (i = 1; i <= 24; i++)
{
if (i <= 2)
{
a = 1;
b = 1;
}
else
{
c = a + b;
a = b;
b = c;
}
}
printf("两年之后可以繁殖%d对兔子\n", b);
return 0;
}
1
l'l
666