0.10个
1.11个
2.a=(b=(c=5))
3.3,9, 4
4.x>0 ? z = x : z = -x
5.if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
readin: scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
goto readin;
666
这个兔子有点难啊
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;
}
11
虚心前来学习
测试题:
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.
111
1
dasd
测试题
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;
}
报个到
是
111111111
.....
谢谢甲鱼老师
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
@小甲鱼
动动手第二题
我把n定义成整型,输出一直为4,把n定义成double就为答案3.1415926
为什么,求教?
其实这就是数学问题,我越来越觉得为什么学数学的人更适合学编程
#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;
}