|
发表于 2023-2-13 23:38:03
|
显示全部楼层
0,10
1,11
2,c = 5;
b = c;
a = b;
abc都是
3,c = 9,b =5,a=14
4,z = x < 0?x*-1:x
5A,if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
b,if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
c,
scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
0,#include <stdio.h>
#include<math.h>
int main()
{
double lwb = 10000.0,hy = 10000.0, year=0.0;
double a=0.0,b=0.0;
for(year = 0;;year++)
{
if(a>=b)
{
a = lwb + lwb * 0.1 * year;
b = hy * pow(1.05,(int)year);
printf("小甲鱼:%.2f,黑夜:%.2f\n",a,b);
}
else
break;
}
printf("%d年后,黑夜的投资额超过小甲鱼!\n小甲鱼的投资额是:%.2f\n黑夜的投资额是:%.2f\n",(int)year-1,a,b);
return 0;
}
1,#include <stdio.h>
#include<math.h>
int main()
{
float money = 400.0,year;
for(year= 1;money>= 50;year++)
{
money -= 50;
money *= 1.08;
}
printf("%d年之后,小甲鱼一贫如洗,%f",(int)year,money);
return 0;
}
2,
#include <stdio.h>
#include<math.h>
int main()
{
double PI=0.0,fm=1.0,fz=1.0,result;int i;
for(i = 1;fm<=pow(10,8);i++)
{
result = fz/fm;
if(i%2==0)
{
result *= -1.0;
}
PI+= result;
fm += 2.0;
}
printf("%.8f",PI);
return 0;
}
3,#include <stdio.h>
#include<math.h>
int main()
{
int month,result,tnum=0,tnum0=0,tnum1=0;
for(month = 0;month<=24-1;month++)
{
tnum0 = tnum;
tnum = tnum1;
if(month==0)
{
tnum = 0;
}
else if(month==1)
{
tnum =1;
}
else
{
result = tnum+ tnum0;
}
tnum1 = result;
}
printf("%d",result);
return 0;
}
|
|