酴醾
发表于 2018-10-21 10:35:31
0.10
1.10个
2.c
3.a = 15 b = 5 c = 10
4.z = x >= 0 ? z = x : z = -x
5.A
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
else
bill = cost * flag;
if (ibex > 14)
{
sheds = 3;
}
else
{
sheds = 2;
help = 2 * sheds;
}
C.
do
{
scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
break;
}
else
{
count++;
}
}
while (score >=0);
1.#include <stdio.h>
//单利息即每年的利息均为投资额 * 利率;复合利息则是每年的本息所得作为第二年的投资额。
int main()
{
float a = 10000,b = 10000,count = 0;
while (1)
{
a = a + 10000 * 0.1;
b = b * 1.05;
count++;
if (a < b)
{
break;
}
}
printf("%.0f年后,a的钱比b少\n",count);
printf("a的投资额是%.2f\n",a);
printf("b的投资额是%.2f\n",b);
return 0;
}
#include <stdio.h>
int main()
{
float a = 4000000,b = 0;
int count = 0;
while (1)
{
a = a - 500000 + b;
b = a *0.08;
count++;
if(a <= 0)
{
break;
}
}
printf("%d年后,a就没钱了");
return 0;
}
天地一口香
发表于 2018-10-21 14:59:46
11
依爱
发表于 2018-10-22 14:08:37
虚心前来学习
刘小饭
发表于 2018-10-23 10:59:50
测试题:
0.10次
1.零个
2.a,b,c
3.a=14,b=5,c=9
4.x >=0 ? z = x : z = -x;
5.
A.
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
B.
do
{
scanf("%d", &score);
printf("count = %d\n", count);
count++;
}while(score < 0);
动动手:
1.
从入门到什么
发表于 2018-10-23 15:32:00
111
周庙强
发表于 2018-10-23 21:33:12
1
蓝白格子衬衫
发表于 2018-10-23 21:57:46
dasd
MrZero
发表于 2018-10-24 19:36:01
测试题
0、10个
1、0个
2、c、b、a
3、a=14 b=5 c=9
4、z = x < 0 ? -x : x;
5、
A
if (size > 12)
{
cost *= 1.05;
flag = 2;
}
bill = cost * flag;
B
if (ibex >14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C
while (1)
{
scanf("%d", &score);
if (score < 0)
{
break;
}
count++;
}
printf("count = %d\n", count);
动动手
0、
#include <stdio.h>
#include <math.h>
#define SUM 10000
int main()
{
double turtle, neight;
int count = 0;
do {
count++;
turtle = SUM * (1 + 0.1 * count);
neight = SUM * pow(1 + 0.05, count);
} while (neight < turtle);
printf("%d年后,黑夜的投资额超过小甲鱼!\n小甲鱼的投资额是:%.2f\n黑夜的投资额是:%.2f\n", count, turtle, neight);
return 0;
}
1、
#include <stdio.h>
int main()
{
double sum = 400;
int count = 0;
while (sum > 0)
{
count++;
sum = (sum - 50) * 1.08;
}
printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n", count);
return 0;
}
2、
#include <stdio.h>
#include <math.h>
int main()
{
double pi = 0, temp = 1, sign = 1;
int i = 0;
while (fabs(temp) > pow(10, -8))
{
i++;
pi += temp;
sign = -sign;
temp =sign / (2 * i + 1);
}
pi *= 4;
printf("圆周率为:%.2f\n", pi);
return 0;
}
3、
#include <stdio.h>
int main()
{
int num = 1, tmp = 0;
for (int i = 2; i <= 24; i++)
{
tmp = num;
num += tmp;
}
printf("两年后兔子的数量是%d对。\n", num);
return 0;
}
LeanGovern
发表于 2018-10-24 21:19:31
报个到
满天星的恋情
发表于 2018-10-25 09:23:22
是
冲鸭小小苏
发表于 2018-10-26 21:39:05
111111111
翜篦丶
发表于 2018-10-27 16:38:09
.....
qiben
发表于 2018-10-28 00:06:04
谢谢甲鱼老师
学习龙
发表于 2018-10-28 14:51:25
0:
100
1:
0
2:
c b a
3:
5+4=9
5
4
4:
z=x>=0?x:(-x);
5:
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
while(1)
{
scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
count++;
}
}
0:
# include <stdio.h>
int main ()
{
int i =1;
for(;10000*0.1*i > 10000*pow(1.05,i)-10000;i++ )
{
;
}
printf("%d,%f,%f",i,10000*0.1*i+10000,10000*pow(1.05,i));
return 0;
}
1:
# include <stdio.h>
int main ()
{
int i = 0;
int restmoney =400;
for(;restmoney > 0;i++)
{
restmoney = restmoney - 50;
restmoney = restmoney * (1+0.08);
}
printf("%d",i);
return 0;
}
2:
# include <stdio.h>
# include <math.h>
int main ()
{
int i = 1;
int j = 1;
double sum = 0;
double last = 1;
for(;last > pow(10 , -8);)
{
i = i + 2;
sum = sum + 1 + 1/(pow(-1,j)*i);
last = fabs(1/(pow(-1,j)*i));
printf("%.9f\n", last);
j++;
}
printf("%.7f", 4*sum);
return 0;
}
3:
28657
学习龙
发表于 2018-10-28 15:22:23
@小甲鱼
动动手第二题
我把n定义成整型,输出一直为4,把n定义成double就为答案3.1415926
为什么,求教?
fincal
发表于 2018-10-28 20:19:27
其实这就是数学问题,我越来越觉得为什么学数学的人更适合学编程
a512987813a
发表于 2018-10-30 16:39:55
#include <stdio.h>
#include <math.h>
#define E(n) pow(n, -1)
int main()
{
double temp=0, result;
int i;
for (i=1; i<pow(10, 6)-2; i+=4)
{
temp += E(i) - E(i+2);
printf("i = %d, result = %.7f\n", i, temp * 4);
}
result = 4 * temp;
printf("%.7f", result);
return 0;
}
陵肆
发表于 2018-10-30 19:00:42
每日一节
fanchenli
发表于 2018-10-31 18:45:08
{:5_90:}
kazami_yuyuko
发表于 2018-10-31 19:33:27
穷死了