VALENTINE.S
发表于 2020-2-27 21:37:30
#include <stdio.h>
#define TAX1 0.1
#define TAX2 0.05
int main()
{
double sum_jiayu = 0, sum_heiye = 10000.0f ;
int year;
for(year = 1 ; ; year++)
{
sum_jiayu = 10000.0f * TAX1 * year + 10000.0f;
sum_heiye = sum_heiye * (1 + TAX2);
if(sum_heiye >= sum_jiayu)
{
break;
}
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n" ,year);
printf("小甲鱼的投资额是:%.2lf\n",sum_jiayu);
printf("黑夜的投资额是:%.2lf\n" , sum_heiye);
return 0;
}
#include <stdio.h>
#define TAX2 0.08
int main()
{
int year;
float x = 400;
for(year = 0; ;year++)
{
x = x * (1 + TAX2);
x -= 50;
if( x <= 50)
{
break;
}
}
printf("%d年后小甲鱼败光了所有家产,一贫如洗……\n" , year);
return 0;
}
yongrenzirao772
发表于 2020-2-27 22:51:22
看看
陌生人11
发表于 2020-2-28 01:05:52
。
yourboylt
发表于 2020-2-28 03:15:36
.
gssdzdcyyush
发表于 2020-2-28 13:04:08
{:5_109:}@
zm_selina
发表于 2020-2-28 13:48:29
本帖最后由 zm_selina 于 2020-2-28 13:52 编辑
测试题:
0:10个A
1: 0个B
2:a,b,c
3:14, 9, 5
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;
}
else
{
sheds = 2;
}
help = 2 * sheds;
C:scanf("%d", &score);
while(score>=0)
{
count++;
scanf("%d", &score);
}
printf("count = %d\n", count);
动动手:
0:
#include <stdio.h>
int main()
{
int year = 0;
float xijiayu = 10000, heiye = 10000;
float i = 0.1, j = 0.05;
while(1)
{
xijiayu += 10000 * i;
heiye *= (1 + j);
year++;
if(heiye > xijiayu)
{
break;
}
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n", year);
printf("小甲鱼的投资额是:%.2f\n", xijiayu);
printf("黑夜的投资额是:%.2f\n", heiye);
return 0;
}
1:
#include <stdio.h>
int main()
{
int year = 0;
float money = 4000000, spending = 500000;
float i = 0.08;
while(money>0)
{
money = (money-spending)* (1+i);
year++;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗...!\n", year);
return 0;
}
2:
#include <stdio.h>
#include <math.h>
int main()
{
double pi = 0;
double i = 1, flag = 1;
while(1)
{
pi = pi + (1/i*flag);
i = i + 2;
flag = - flag;
if(1/i < pow(10,-8))
{
break;
}
}
printf("%.7f", pi*4);
return 0;
}
3:
#include <stdio.h>
int main()
{
int a = 0, b = 1, c = 0, i;
for(i=1; i<=24; i++)
{
a = b;
b = c;
c = a + b;
printf("%d", c);
}
return 0;
}
奶猫
发表于 2020-2-28 14:20:56
喵
LeonardH
发表于 2020-2-28 14:49:24
LOOK LOOK
南山台
发表于 2020-2-28 15:33:07
看答案
EmmmmmmTRUE
发表于 2020-2-29 07:53:56
0、10;
1、0;
2、5;
3、14,5,9;
4、z=x>0?x:-x;
非常爱学习
发表于 2020-2-29 11:27:29
0.10
1.10
2.abc
3.5 5 9
4.z = x < 0 ? -x : x
5.if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
else
bill = cost * flag;
以后and未来
发表于 2020-2-29 12:05:59
学习{:10_265:}
每天生活都美好
发表于 2020-2-29 16:28:00
复
g1023938847
发表于 2020-2-29 16:31:30
0.100
1.10
2.a,b,c?
3.b=3,c=8,a=13
4.
5.A:if (size > 12)
{
break;
}
cost = cost * 1.05;
flag = 2;
bill = cost * flag;
B:if (ibex > 14)
{
sheds = 3;
break;
}
else
{sheds=2;
}help = 2 * sheds;
最烦想名字
发表于 2020-2-29 17:49:33
1
milesl
发表于 2020-2-29 19:04:39
打卡
keterbasary
发表于 2020-2-29 20:41:37
q
嘟嘟橙
发表于 2020-2-29 21:38:13
来
嘟嘟橙
发表于 2020-2-29 21:51:14
嘟嘟橙 发表于 2020-2-29 21:38
来
测试题第0条j没有初始化吧。。。它要先进入第一个for才能到第二个啊,我在VS上运行就报错了。。。
2399473044
发表于 2020-2-29 22:42:15
复