|
发表于 2019-11-28 17:56:10
|
显示全部楼层
0、10个
1、0次
2、a=b;b=c;c=5; a b c
3、c = 9 a = 14 b = 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:
do{
scanf("%d",&score);
count ++;
}while(score < 0)
count--;
printf("count = %d\n",count);
6、
#include<stdio.h>
int main()
{
float sumj,sumh=10000,int1=0.1,int2=0.05;
int year = 0;
while(sumh < sumj)
{
sumj += 10000 * int1;
sumh = sumh*(1 + int2);
year++;
}
printf("%d年后,黑夜的投资金额超过小甲鱼!\n",year);
printf("小甲鱼的投资金额是:%.2f\n",sumj);
printf("黑夜的投资金额是:%.2f\n",sumh);
return 0;
}
7、
#include<stdio.h>
int main()
{
float lef = 4000000,ints=0.08,cost=50000;
int year=0;
while(lef>0)
{
lef=(lef-cost)*(1+ints);
year++;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗...\n",year);
return 0;
}
8、
#include<stdio.h>
int main()
{
double fenmu = 1, i = 1;
double goal = 0,res;
do{
goal = goal + i/fenmu;
i = -i;
fenmu = fenmu + 2;
printf("1/fenmu : %.10f\n",1/fenmu);
}while(1/fenmu > 0.00000001);
res = goal * 4;
printf("res : %.10f\n",res);
return 0;
}
9、两年后会有2732对兔子。 |
|