Anonymous
发表于 2021-6-27 08:31:00
本帖最后由 匿名 于 2021-6-27 08:32 编辑
后面两题运行是死循环,一直不出来结果……{:10_266:}
丶磊子
发表于 2021-6-27 21:20:08
的机会
心瘾6
发表于 2021-6-28 14:33:59
1
YXiangbao
发表于 2021-6-28 18:06:25
0.100个
1.
2.a,b,c
3.14,5,8
4.
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;
}
LucasChen
发表于 2021-6-29 11:19:55
。。。。
bangec
发表于 2021-6-29 20:44:02
。。。。。。。。。。。。。。
七月何夕
发表于 2021-6-29 21:56:05
看看
XuPeng12345
发表于 2021-6-30 00:04:57
111
乌萨斯的凛冬
发表于 2021-6-30 15:24:45
i got it
17711704510
发表于 2021-6-30 21:59:24
1
沐羽尘
发表于 2021-7-1 01:43:05
10
0
a,b,c
14 5 9
z = x > -x ? x : -x
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
break;
}
else
{
bill = cost * flag;
}
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
while (scanf("%d", &score))
{
if (score < 0)
{
printf("count = %d\n", count);
break;
}
count++;
}
0.#include <stdio.h>
int main()
{
float a = 10000, b = 10000;
int count = 0;
while (a >= b)
{
count++;
a += 10000 * 0.1;
b *= 1.05;
}
printf("%d年后,黑夜的投资超过了小甲鱼!\n黑夜的投资额是%.2f\n小甲鱼的投资额是%.2f\n", count, b, a);
}
1.#include <stdio.h>
int main()
{
float money = 400;
int year = 0;
while (money > 0)
{
year++;
money -= 50;
money *= 1.08;
}
printf("%d年后,小甲鱼又变得一贫如洗!\n", year);
}
2.#include <stdio.h>
#include <math.h>
int main()
{
double i = 3.0;
double num = 1.0;
int count = 1;
int max =pow(10, 8);
while (fabs(i) <= max)
{
if (count%2)
{
num += (1.0/-i);
}
else
{
num += (1.0/i);
}
i += 2.0;
count++;
}
printf("%.8f", num * 4);
}
3.#include <stdio.h>
int main()
{
int m1 = 2, m2 = 0, m = 0;
int count1, count2, count;
int mon;
m1 = 2;
for (mon = 0; mon < 24; mon++)
{
count1 = m1;
count2 = m2;
count = m;
m2 += count1;
m += count2;
m1 += count;
m2 -= count2;
m1 -= count1;
}
printf("总共有%d只兔子\n", m1+m2+m);
}
破口袋
发表于 2021-7-1 09:48:12
查看参考答案
木辛白告
发表于 2021-7-1 13:41:43
1
番茄特ma的
发表于 2021-7-1 18:44:46
1
Tohkaa
发表于 2021-7-1 23:08:40
0.10
1.11
2.abc
3.a14,b5,c9
4.z=x>=0 ? x : -x;
5.A:if(size>12){a;}
b;
B:if(ibex>14){sheds=3;}
else{sheds=2;}
help=2*sheds;
C:while(scanf()){count++;}
破口袋
发表于 2021-7-2 10:46:17
#include<stdio.h>
int main()
{
int t1 = 1, t2 = 0, t3, i = 1;
for(i; i <= 24; i ++)
{
t3 = t1 + t2;
t2 = t1;
t1 = t3;
}
printf("两年后有%d只兔子",t2);
return 0;
}
阿凯加油
发表于 2021-7-2 15:22:08
我没做对生气了
要强求
发表于 2021-7-2 16:41:19
0.100
1.9
2.a=5
3.a=14
b=5
c=9
4.z=x>=0?x:abs(x);
5.if(size>12)
{
cost = cost * 1.05;
flag =2;
}
bill=cost*flag;
b; if(ibex>14)
{
sheds=3;
}
sheds=2;
help=2*sheds;
c;#include <stdio.h>
int main()
{
int score,count=1;
scanf("%d",&score);
while(score>=0)
{
scanf("%d",&score);
}
while(score<0)
{
printf("count=%d\n",count);
count++;
scanf("%d",&score);
}
return 0;
}
0.
sgwhww
发表于 2021-7-2 18:32:43
hei
hukl
发表于 2021-7-3 13:52:41
0、100
1、10
2、a,b,c
3、c=9,b=5,a=14
4、x < 0 ? -x = z : x=z;
5、
A、if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
B、
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C、while(1)
{
readin: scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
}
动手0、#include<stdio.h>
int main()
{
float fish=10000,black=10000;
int year;
while(black <= fish)
{
fish = fish + 0.1*10000;
black = black +black*0.05;
year = year + 1;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n",year);
printf("小甲鱼的投资额是:%.2f\n",fish);
printf("黑夜的投资额是:%.2f\n",black);
return 0;
}
1、#include<stdio.h>
int main()
{
float fish = 400;
int year = 0;
while(fish >= 0)
{
fish = fish + fish * 0.08 - 50;
if(fish < 0)
{
break;
}
year = year + 1;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......",year);
return 0;
}
2、#include<stdio.h>
#include<math.h>
int main()
{
int i=1;
double sum = 1,n = 1,j=3;
while(fabs(n) > 1e-8)
{
i=-i;
n = i / j;
sum = sum + n;
j = j + 2;
}
printf("%.7f\n",sum*4);
return 0;
}
3、#include<stdio.h>
int main()
{
int a = 1,b = 1,i,sum;
for(i = 3;i <= 24;i++)
{
sum = a + b;
a = b;
b = sum;
}
printf("%d",sum);
return 0;
}