加油
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;
}
#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;
}
}
好
123
{:5_109:}这次作业做的感觉还8错奥
答案
{:10_254:}
。
{:10_277:}
答案
请回答
ddd
1
已完成
小甲鱼0000
谢谢分享~!!!!!
答案
1
动手题把我绕晕了