来晚了
发表于 2021-1-4 22:30:14
谢谢
BlueGarlic
发表于 2021-1-5 05:54:49
aaa
Uijin_达达
发表于 2021-1-5 22:46:07
动动手0.
#include <stdio.h>
float Si = 0;//Single interest
float Ci = 0;//Compound interest
int years = 1;
float F = 0, N = 0; //fish, night
float F_P = 10000.00,N_P = 10000.00;// Principal
float F_rate = 0.10, N_rate = 0.05;
int main()
{
do
{
N_P = N_P + Ci;
Ci = N_P * N_rate;
Si = (F_P * F_rate);
F = F_P + years * Si;
N = N_P + Ci;
N = N_P + Ci;
if(N > F)
{
break;
}
years++;
}
while(F > N);
printf("%d years later, fish's investment will exceed night!\n", years);
printf("fish's investment amount are: %.2f\n", F);
printf("night's investment amount are: %.2f\n", N);
return 0;
}
1.
#include <stdio.h>
float principal = 4000000;
float interest = 0;
int years = 0;
int main()
{
do
{
principal -= 500000;
interest = principal * 0.08;
principal = principal + interest;
years++;
}
while(principal > 0);
printf("%d\n ", years);
return 0;
}
周大丢
发表于 2021-1-6 14:33:33
{:7_141:}
qwghgh
发表于 2021-1-6 21:17:40
参考答案
swk123123
发表于 2021-1-6 23:30:10
0. 不能执行
1. 0次
2. a,b,c同时赋值5
3.a=15,b=5,c10
4. z=x>0?x:-(x);
5.
A: if(size>12)
{
cost = cost*1.05;
}
bill = cost*flag;
flag = 2;
B. if(ibex>14)
{
sheds = 3;
}
sheds = 2;
help = 2 *sheds;
C. if(score<0)
{
printf("count = %d\n",count);
}
count++;
scanf("%d",&score);
动动手
swk123123
发表于 2021-1-6 23:35:51
0. 10次
1. 0次
2. a,b,c同时赋值5
3.a=15,b=5,c10
4. z=x>0?x:-(x);
5.
A: if(size>12)
{
cost = cost*1.05;
flag = 2;
}
bill = cost*flag;
B. if(ibex>14)
{
sheds = 3;
}
else
sheds = 2;
help = 2 *sheds;
C.
scanf("%d",&score);
if(score<0)
{
printf("count = %d\n",count);
}
count++;
820qazwsx
发表于 2021-1-6 23:59:02
答案
Uijin_达达
发表于 2021-1-7 22:52:57
本帖最后由 Uijin_达达 于 2021-1-7 23:00 编辑
2.#include <stdio.h>
#include <math.h>
double Pi, i, sum, limit, a = 1;
int num = 1;
int main()
{
while(1)
{
i = 1 / a;
limit = pow(10, -8);
if (i < limit)
{
break;
}
if (!(num % 2))
{
i = -i;
}
sum = sum + i;
Pi = 4 * sum;
a+=2;
num++;
}
printf("Pi = %.7f\n", Pi);
return 0;
}
3.
#include <stdio.h>
#include<math.h>
int couple = 1, generation = 1, month = 24, born = 0, brith = 0, flag = 0;
int main()
{
brith = month;
do
{
if (month == (brith - 2))
{
flag = 1;
}
if (flag)
{
generation++;
couple++;
}
month--;
}
while (month > 0);
printf("%d\n", couple);
return 0;
}
King丨小义
发表于 2021-1-8 12:16:18
{:5_102:}
hecheng001
发表于 2021-1-8 13:04:33
1
会有那么一天么
发表于 2021-1-10 04:06:28
已做
jie杰
发表于 2021-1-10 15:26:41
1
apokjj
发表于 2021-1-10 15:33:54
回复
GGBoy5017
发表于 2021-1-10 18:18:07
dsjlkfjl
黯黯不是默
发表于 2021-1-11 09:49:57
回复
BlackSheep98
发表于 2021-1-11 10:07:19
66
Moyuchen_
发表于 2021-1-11 16:44:23
兔子真能生啊
PYJY123
发表于 2021-1-11 17:05:36
{:5_108:}
Lontano
发表于 2021-1-12 13:28:11
gotogoto