测试题:
0.10次
1.0次 开始时 while = 0;//为假就不执行了?
2. a, b, c ; lvalue 是用于识别或定位存储位置的标识符
3.
b=3,c=b+1+5,a = c+1 + b+1;
a == 14; (9+1 + 3+1)
b == 5; (3+1+1)
c == 4; (3+1)
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:
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
动动手:
0.#include <stdio.h>
#include <math.h>
int main()
{
double i, xjy, hy;
for(i=0;hy <= xjy;i++)
{
xjy = hy = 10000;
xjy += (xjy* 0.1)*i ;//单利率:利息=本金x年利率x年数
hy = hy*pow((1 + 0.05) ,i);//复利率:F=P*(1+i)^n
}
printf("%.f年之后,黑夜的投资额超过小甲鱼!\n",i);
printf("小甲鱼的投资额是: %.2lf\n",xjy);
printf("黑夜的投资额是: %.2lf\n",hy);
return 0;
}
1.#include <stdio.h>
int main()
{
double yuan,year;
yuan = 40000000;
for (year=0;yuan >= 0;year++)
{
yuan -= 5000000;
yuan += yuan * 0.08;
}
printf("%.f年之后,小甲鱼败光了所有家产,再次回到一贫如洗......\n",year);
return 0;
}
2.#include <stdio.h>
#include <math.h>
int main()
{
float i=1.0, n=1.0 ,s=1,Pi=0;
for (;fabs(n) >= 10^(-8); i += 2)
{
Pi += n;
s = -s;
n = s/i;
}
Pi = 4*Pi;
printf("Pi = %.7f",Pi);
return 0;
}
3.#include <stdio.h>
int main()
{
int sum, t=2;
for(int year=720;year >= 0;year-=60)
{
sum = t;
for (int mother=2;mother >= 0;mother--)
{
t += 2;
}
t *= 2;
}
printf("%d",sum);
return 0;
}
57332只兔兔? |