本帖最后由 BIYU 于 2020-1-13 00:21 编辑
0:10次
1:0次
2:a,b,c
3:a=14,b=5,c=9
4:5:
A
if(size > 12)
{
cost *=1.05;
flag = 2;
}
bill = cost * flag;
Bif(ibex>14)
{
sheds=3;
}else{
sheds = 2;
}
help = 2*sheds;
Cdo{
scanf("%d",&score);
if(score<0)
{
break;
}
count++;
}while(1);
printf("count = %d\n",count);
6:#include<stdio.h>
int main()
{
double fish=10000,back_e=10000,fish_e=10000;
int year=0;
do{
fish_e += fish*0.1;
back_e += back_e * 0.05;
year++;
}while(fish_e>=back_e);
printf("%d年后黑夜投资额超过小甲鱼\n",year);
printf("此时小甲鱼的投资额为:%.2lf\n",fish_e);
printf("此时黑夜的投资额为:%.2lf\n",back_e);
}
7:[/pre][pre]#include<stdio.h>
int main()
{
double money=4000000,ti_money=500000;
int year=0;
do{
money -= ti_money;
money += money*0.08;
year++;
}while(money>0);
printf("%d年后,小甲鱼败光了所有家产,再次回到了一贫如洗.....\n",year);
}
8:#include<stdio.h>
#include<math.h>
int main()
{
int i=1;
double num=1.0,pi=0.0;//注意,如果这里直接从1开始会出现误差
while(fabs(i/num)>=1e-8)
{
pi += i/num;
i = -i;
num+=2;
}
printf("%.7lf\n",4*pi);
}
9:#include<stdio.h>
int main()
{
long long f1=1,f2=1;
int num,i;
printf("请输入次数:");
scanf("%d",&num);
for(i=2;i<=num/2;i++)
{
f1 = f1 + f2;
f2 = f2 + f1;
}
if(num%2)
{
printf("第%d次是%lld\n",num,f1+f2);
}else{
printf("第%d次是%lld\n",num,f2);
}
}
|