0:回答出10个'A'
1:一个都不会打印。
2:a = 5;
3: a == 14, b == 5, c == 9;
4: z = x > 0 ? x : -x;
5:A if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
else
{
bill = cost * flag;
}
B: if ( ibex > 14)
{
sheds = 3;
}
else
{
help = 2 * sheds;
}
C: while (score >= 0)
{
count++;
scanf("%d", &score);
}
printf("count = %d\n", count);
动动手:
0: for (years = 1; single >= compound; years++)
{
//l=p*i*n
single = 10000 + (10000 * (0.1 * years));
//s=p*(1+i)^n
compound = (10000 * pow((1 + 0.05), years));
++year;
}
printf("%d年后,黑夜的投资额超过王八蛋!\n\
王八蛋的投资额是:%.2f\n\
黑夜的投资额是:%.2f", year, single, compound);
1:
for (years = 1; total_amount > 0; years++)
{
total_amount = total_amount - 500000;
total_amount = (total_amount * 0.08) + total_amount;
if (total_amount <= 500000)
{
total_amount = total_amount - total_amount;
}
}
printf("%d年之后,会小王八^_^会败光所有家产,再次一穷二白。", years);
2:
3:
over
f
么么哒小甲鱼
I love FishC.com!
12
over
坚持胜利
2
1
难受
看答案
0.10
1.0
2.5
3.出错
.
0.10次
1.10次
2.c,b,a
3.a=4,b=5,c=9
4.x>=0?z=x:z=0-x;
5.
看看
看看
答案
本帖最后由 ietar 于 2019-6-29 10:53 编辑
0
just 10
1
...没进循环啊
2
a
3
b=3,c=8 b=4 c=9 b=5 a=14
4
void main(){
float x,z;
printf("x=:");
scanf("%f",&x);
z = x>0?x:-x;
printf("z=%f",z);
}
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
scanf("%d", &score);
while (score >= 0)
{
count++;
scanf("%d", &score);
}
printf("count = %d\n", count);
0
#include <stdio.h>
void main(){
int year;
const float i1=0.1;
const float i2=0.05;
double xjy=10000, heiye=10000;
for(year=0;heiye<=xjy;year++){
xjy += 10000*i1;
heiye *= (1+i2);
}
printf("after %d years, heiye gets more than xjy!\n",year);
printf("xjy:%.2f\nheiye:%.2f",xjy,heiye);
}
1
#include <stdio.h>
void main(){
int year;
double base = 4000000;
for(year=0;base>=0;year++){
base -= 500000;
base *= 1.08;
}
printf("after %d years, sjy sucks!\n",year);
}
2
#include <stdio.h>
#include <math.h>
void main(){
double qpi=0,each=1;
int n,count=0;
for(n=1;fabs(each)>=1e-8;n++){
each = pow(-1,(n+1))/(2*n-1);
qpi += each;
count += 1;
}
printf("pi=%.7f\ncount=%d",4*qpi,count);
}
这tm循环了5000万零1次 怪不得这么慢
3
92736 初项是2 2的fib嘛
#include <stdio.h>
#include <math.h>
void main(){
int a1 = 2, a2=2, limit = 24, temp;
// n1=2, n2=2, n3=n2+n1=4, n4=n3+n2=6, n5=n4+n3=10;
for(int i=3;i<=limit;i++){
temp = a2;
a2 = a1+a2;
a1 = temp;
}
printf("sum=%d",a2);
}
啊是‘对‘ 结果除以2就行了 46368
3