1
#include <stdio.h>
int main() {
float money_xjy = 10000;
float money_hy = 10000;
int year = 0;
while (money_xjy >= money_hy) {
year++;
money_xjy += 10000*0.1;
money_hy *= 1.05;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n\
小甲鱼的投资额是:%.2f 元\n\
黑夜的投资额是:%.2f 元\n\
", year, money_xjy, money_hy);
return 0;
}
#include <stdio.h>
#define PRICE 4000000
#define OVERHEAD 500000
int main() {
int year = 0;
double fortune = PRICE;
do {
fortune -= OVERHEAD;
year++;
fortune *= 1.08;
} while (fortune > 0);
printf("%d年后,小甲鱼败了家产,再次回到一贫如洗...\n", year);
return 0;
}
#include <stdio.h>
#include <math.h>
int main() {
int i = 0;
double num = 1;
double den = 1;
double pi = 0;
while (num/den > pow(10, -8)) {
pi += pow(-1, i)*(num/den);
i++;
den += 2;
}
pi = pi*4;
printf("Pi = %.7f\n", pi);
return 0;
}
#include <stdio.h>
int main() {
long a=1, b=1, c, i;
for (i=3; i<=24; i++) {
c = a+b;
a = b;
b = c;
}
printf("2年后,总共有%ld只兔子!\n");
return 0;
}
{:9_241:}
{:5_106:}
1
看看答案
c
0
回复
1
。
1
喵喵喵
呜呜呜
。
测试题:
0:100个
1:12个
2:a,b,c,都是l-value
3:a= 3 b=3 c=9
4. z=x>0?x:-x;
5. A.
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
else
{
bill = cost * flag;
}
B.
if (ibex > 14)
{
sheds = 3;
}
else
{
sheds = 2;
help = 2 * sheds;
}
C.
while(score > 0)
{
scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
break;
}
count++;
}
1
打卡
0.100
1.10
2.a
3. 15, 3, 4