#include<stdio.h>
#include<math.h>
int main()
{
int money1, money2;
int year = 0;
int a;
while (year != -1)
{
money1 = year * 10000 * 0.1 + 10000;
money2 = pow((1 + 0.05),year) * 10000;
a = money2 - money1;
if (a > 0)
{
printf("第%d年超过\n", year);
break;
}
year = year + 1;
}
return 0;
}
0. 10个
1. 11个
2. a
3. a=15 b=5 c =10
4.#include<stdio.h>
int main()
{
int x, z;
printf("请输入一个变量:\n");
scanf("%d",&x);
if(x>=0)
{
z = x;
}
else if(x<0)
{
x=0 - x;
z = x;
}
printf("%d\n",z);
return 0;
}
0. 10
1.
2. b = c = 5
3. 14 5 9
4. z=(x>0)?x:-x
5. if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}else
bill = cost * flag;
if (ibex > 14)
{
sheds = 3;
}else{sheds = 2;help = 2 * sheds;}
readin: scanf("%d", &score);
while(score >= 0)
{
readin: scanf("%d", &score);
count++;
}
count++;
printf("count = %d\n", count);
1
10个
10个
a,b,c
a=14,b=5,c=9
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
bill = cost * flag;
}
else bill = cost * flag;if (ibex > 14)
{
sheds = 3;
help = 2 * sheds;
}
else
{
sheds = 2;
help = 2 * sheds;
}while(1)
{
readin: scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
break;
}
count++;
}# include<stdio.h>
int main(void)
{
float a,b,c;
int i;
printf("请输入小甲鱼和黑夜的初始资金:\n");
scanf("%f",&a);
b=c=a;
for(i=1;b<=c;i++)
{
c = a*(1+0.1*i);
b *=(1+0.05);
}
printf("%d年以后,黑夜的资产超过小甲鱼\n",i);
printf("小甲鱼的资产是:%.2f\n黑夜的资产是:%.2f\n",c,b);
return 0;
}# include<stdio.h>
int main(void)
{
float lottery=400;
int year = 0;
while(lottery>0)
{
lottery = (lottery - 50)*(1+0.08);
year ++;
}
printf("%d年后,小甲鱼败光所有家产,再次回到一贫如洗!\n",year);
}# include<stdio.h>
# include<math.h>
int main(void)
{
float pi = 1, a = 3;
while(fabs(1/a)>10^(-8))
{
pi = pi + (-1/a);
a = -(a+2);
}
printf("精确到小数后七位的圆周率是:%.7f",4*pi);
return 0;
}
。
0. 10个A
1.10个B(上机后结果为不会打印,复习了i++的逻辑)
2.a=5;b=5;c=5;
3.a=13 b=3 c =9
4.if(x<0)
{x=-x;}
5.if(size>12)
{cost *=1.05;
flag=2;
}
else
{bill=cost*flag;}
if(ibex>14)
{
sheds =3;
}
else
{
sheds=2;
help=2*sheds;
}
while(1)
{
readin:scanf("%d",&score);
if(score<0)
{
printf("count=%d\n",count);
break;
}
count++;
}
#include<stdio.h>
#include<math.h>
int main()
{
int i;
double a=10000,b;
for (i=1;;i++)
{
a=a+10000*0.1;
b=10000*pow(1.05,i);
if(a<b)
{
printf("%d年后,黑夜的投资额超过小甲鱼!\n",i);
printf("小甲鱼的投资额是:%.2f\n",a);
printf("黑夜的投资额是:%.2f\n",b);
break;
}
}
return 0;
}
1
答案
yo
回复
感谢!
T
0.100 1.11 2.a3.145 8 5.if(size>12)
{
cost = cost *1.25;
flag = 2;
}
else
bill = cost *flag;
if(ibex > 14)
{
sheds = 3;
}
else
{
sheds = 3;
if (score < 0)
{
printf("count = %d\n", count);
}
else
{
count++;
scanf("%d", &score);
}
help = 2*sheds
}
。
11111111111111111
第十六课 捡回来!
参考答案
111