Yth961102zxc
发表于 2020-4-4 11:29:04
加油
steph0216
发表于 2020-4-4 19:09:46
0.#include<stdio.h>
int main()
{
double fish=10000, night=10000, temp = fish*0.1;
int count=0;
while (fish >= night)
{
fish += temp;
night += night*0.05;
count++;
}
printf("After %d years, night has more money than fish\n", count);
printf("Fish:%.2f\n", fish);
printf("Night:%.2f\n", night);
return 0;
}
1.#include<stdio.h>
int main()
{
double ivm=400;
int count=0;
while (ivm>0)
{
ivm -= 50;
ivm += ivm*0.08;
count++;
}
printf("After %d years fish used all his money.\n", count);
return 0;
}
2.#include<stdio.h>
#include<math.h>
int main()
{
double pi=0, temp=1;
while (fabs(1/temp) >= pow(10, -8))
{
pi += 1/temp;
pi = -pi;
temp += 2;
}
printf("Result: %.7f\n", 4.0*fabs(pi));
return 0;
}
3.#include<stdio.h>
int main()
{
int a=0, b=1, c;
for (int i=1; i<=24; i++)
{
c = a + b;
a = b;
b = c;
}
printf("The total number of rabbits: %d\n", b);
return 0;
}
起风了呀
发表于 2020-4-4 19:30:21
#include <stdio.h>
#include <math.h>
int main()
{
double num1 = 1,num2;
int j ,i=1;
while (1)
{
if (fabs(num2/i)<pow(10,-8))
{
printf ("%.7e",num1*4);
break;
}
else
{
num1 = num1-(num2/i);
i = -i;
}
}
}
/*
#include <stdio.h>
int main ()
{
int j;
float i = 4000000.0;
for (j=0;j>=0;j++)
{
if (i<0)
{
printf ("%d之后,小甲鱼败光所有的家产,再次回到一贫如洗....",j);
break;
}
else
{
i = (i-500000)*1.08;
}
}
}
#include <stdio.h>
int main()
{
int k;
float j=10000,i=10000;
for(k=0;k>=0;k++)
{
if (i<j)
{
printf ("%d年后,黑夜的投资额超过小甲鱼\n",k);
printf ("小甲鱼的投资额是%f\n",i);
printf ("黑夜的投资额是%.2f\n",j);
break;
}
else
{
i = i+10000*0.1;
j = j+j*0.05;
}
}
gscgodo
发表于 2020-4-4 20:50:33
好
jk2862148
发表于 2020-4-4 23:49:33
123
Zcz123
发表于 2020-4-5 15:30:41
{:5_109:}这次作业做的感觉还8错奥
八块腹肌的胖子
发表于 2020-4-6 11:32:26
答案
sand_man
发表于 2020-4-6 12:28:40
{:10_254:}
pll001211
发表于 2020-4-6 12:49:55
。
彭格列XI代
发表于 2020-4-6 14:59:00
{:10_277:}
浮生123
发表于 2020-4-7 13:45:38
答案
少而弥坚
发表于 2020-4-7 21:13:17
请回答
mr6923612
发表于 2020-4-7 22:46:03
ddd
起兮
发表于 2020-4-8 09:25:18
1
朕的小鱼干呢
发表于 2020-4-8 16:00:03
已完成
行云流水李可以
发表于 2020-4-8 16:05:35
小甲鱼0000
ssnuje
发表于 2020-4-8 16:51:25
谢谢分享~!!!!!
z1484237173
发表于 2020-4-8 17:31:20
答案
dxq11
发表于 2020-4-9 08:19:22
1
jiayougmt
发表于 2020-4-9 10:11:48
动手题把我绕晕了