|
发表于 2016-8-25 17:24:21
|
显示全部楼层
s1e16
0.10
1.10
2.a
3.3,5,9
4.z = x >= 0 ? x : -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
while(scanf("%d", &score)){
if(score < 0){
printf("count = %d\n", count);
}
count++;
}
动动手
0.
#include <stdio.h>
int main(){
float xjy_money=0, hy_money=0;
int y=1;
float bj = 10000, hy_bj;
while(1){
xjy_money = bj + bj * 0.10 *y;
if(1 == y){
hy_money = (1 + 0.05) * bj;
}else{
hy_money = (0.05 + 1) * hy_money;
}
if(hy_money > xjy_money){
break;
}
y++;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n",y);
printf("小甲鱼的投资额是:%.2f\n",xjy_money);
printf("黑夜的投资额是:%.2f\n",hy_money);
return 0;
}
1.
#include <stdio.h>
int main(){
int y;
float money = 4000000,y_m = 500000;
for(y = 1; money > 500000; y++){
money = (money - y_m) *(1+ 0.08);
}
printf("%d年之后\n",y);
return 0;
}
2.
#include <stdio.h>
int main(){
int i=1, j=1;
float temp;
for(i; i< 100000000; i++){
if(i%2 != 0){
temp += 1.0/j;
j += 2;
}else{
temp -= 1.0/j;
j += 2;
}
}
printf("PI约等于%.8f\n", temp*4);
return 0;
}
3.
#include <stdio.h>
#include <math.h>
int main(){
int month = 24;
int num = 2;
num = pow(num,month);
printf("%ld\n",num);
return 0;
}
|
|