|
发表于 2017-6-5 20:58:21
|
显示全部楼层
测试题:
0.10个
1.0个
2.a,b,c
3.14,5,9
4.
#include<stdio.h>
int main()
{
int x,z;
printf("请输入一个数字: ");
scanf("%d",&x);
z=(x<0)?-x:x;
printf("%d",z);
return 0;
}
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:
readin: scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
readin;
动动手:
0.
#include<stdio.h>
int main()
{
float p = 10000.00;
float xjy ,hy;
int n = 0;
while (xjy > hy)
{
n++;
xjy = p + p*0.1*n;
hy = p * pow(1+0.05,n);
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n",n);
printf("小甲鱼的投资额是:%.2f",xjy);
printf("黑夜的投资额是:%.2f",hy);
return 0;
} |
|