杨斌522
发表于 2020-3-10 20:58:27
计算需要多久小甲鱼才会败光所有家产?
哈哈,你是想笑死我,好继承我的花呗?
Mr.how丶
发表于 2020-3-10 21:22:31
0.0
赵浩添
发表于 2020-3-10 22:09:44
是
Ayanam1
发表于 2020-3-11 10:35:34
1
鱼塘里的鱼
发表于 2020-3-11 10:57:56
111
及格再改名
发表于 2020-3-11 14:01:13
{:7_146:}
菜月昴
发表于 2020-3-11 14:20:25
看看
onecab
发表于 2020-3-11 15:44:03
can
江渔火
发表于 2020-3-11 15:57:08
0题.10次
1题.9次
2题:5是c的l-value,c是b的l-vallue,以此类推。
3题:a = 14;b = 5; c = 9;
4题:
#include <stdio.h>
int main()
{
float x, z;
printf("请输入一个数字:\n");
scanf("%f", &x);
if (x > 0)
z = x;
else
z = -x;
printf("绝对值为:%.2f\n", z);
return 0;
}
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;
C:
while (1)
{
scanf("%d", &score);
if (score < 0);
{
printf("cout = %d\n", count);
break;
}
count++;
}
动动手:
0题:
#include <stdio.h>
int main()
{
int year = 0;
double lwg = 10000, hy = 10000, wp, hp;
hp = hy;
wp = lwg;
while (hp <= wp)
{
wp = wp + lwg * 0.1;
hp = hp + hp * 0.05;
year++;
}
printf("%d年后,黑夜的投资额超过小甲鱼\n", year);
printf("小甲鱼的投资额为:%.2f\n", wp);
printf("黑夜的投资额为:%.2f\n", hp);
return 0;
}
1题:
#include<stdio.h>
int main()
{
double lotty = 4000000, div;
int year = 1;
div = 4000000 * 0.08;
do
{
lotty = lotty + div - 500000;
div = lotty * 0.05;
year++;
} while (lotty >= 0);
printf("%d年后,小甲鱼败光了所有的家产,再次回到一贫如洗......", year);
return 0;
}
2题:
#include<stdio.h>
#include<math.h>
int main()
{
long double tmp, pi = 0, den = 1;
int key = 1;
do
{
tmp = 1 / den;
if (key % 2)
pi = pi + tmp;
else
pi = pi - tmp;
key++;
den = den + 2;
}while (tmp > pow(10, -8));
pi = 4 * pi;
printf("pi的近似值为:%0.7f", pi);
return 0;
}
3题:
#include<stdio.h>
#include<math.h>
int main()
{
//y_0num表示0个月的兔子,y_0t是一个防止计算混乱的中间值。
long int num, y_0num = 2, y_0t = 0, y_1num = 0, y_1t = 0, y_onum = 0, y_ot = 0;
int month = 1;
while (month <= 24)
{
if (y_0num)
{
y_1t = y_0num;
y_0num = 0;
}
if (y_1num)
{
y_ot = y_1num;
y_1num = 0;
}
if (y_onum)
{
y_0t = y_onum * 2;
}
//传导数据
y_0num = y_0t;
y_1num = y_1t;
y_onum = y_onum + y_ot;
//中间值清零
y_0t = 0;
y_1t = 0;
y_ot = 0;
month++;
}
num = y_0num + y_1num + y_onum;
printf("两年后,共有%ld只兔子",num);
return 0;
}
大飘客00K
发表于 2020-3-11 19:11:56
111
炘之源
发表于 2020-3-11 21:30:15
1
从零开始到成功
发表于 2020-3-12 10:05:53
兔子也太难弄了吧
梦旅
发表于 2020-3-12 10:43:13
0.100个
1.9个
2.c,b,a
3. 14 5 9
4. x<0?z=-x:z=x;
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.
readin: scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
0.
#include <stdio.h>
#include <math.h>
int main()
{
int n,a;
float r1, r2;
float total1, total2;
a = 10000;
r1 = 0.1;
r2 = 0.05;
n = 0;
do
{
n++;
total1 = a * (1 + r1*n) ;
total2 = a * pow((1 + r2), n);
}
while (total1 >= total2);
printf("%d年后,黑夜的投资额将超过小甲鱼\n", n);
printf("小甲鱼的投资额为%.2f\n", total1);
printf("黑夜的投资额为%.2f\n", total2);
return 0;
}
1.
#include <stdio.h>
#include <math.h>
int main()
{
int n, b;
float r,total;
n = 0;
b = 50;
r = 0.08;
total = 400;
do
{
n++;
total = (total - 50) * (1+r);
}
while (total >= 0);
printf("%d年后,小甲鱼败光了所有家产,回到一贫如洗\n", n);
return 0;
}
2.
#include <stdio.h>
#include <math.h>
int main()
{
double a,count;
int n = 1;
count = 1;
while (n < (pow(10, 8) + 1) / 2)
{
n++;
if (n % 2 == 0)
{
a = -(1.0 / (2 * n - 1));
}
else
{
a = 1.0 / (2 * n - 1);
}
count = count + a;
}
printf("pi的近似值为%.7f", 4 * count);
return 0;
}
fengshan5577
发表于 2020-3-12 15:23:54
真想知道
kroosaaa
发表于 2020-3-12 15:35:42
答案
那没事了
发表于 2020-3-12 17:23:52
44
Burning0619
发表于 2020-3-12 17:37:48
0.10
1.0
2.
3.844
4.z=a>0?a:-a;
5.
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
if (ibex > 14)
{
sheds = 3;
}
else
sheds = 2;
help = 2 * sheds;
unicornj
发表于 2020-3-12 18:07:17
赶紧跟进
迷途旅人orz
发表于 2020-3-12 20:00:17
1
肖肖肖up
发表于 2020-3-12 21:55:47
c