|
发表于 2020-10-13 11:47:23
|
显示全部楼层
0.10
1.0
2.a
3.
a=3
b=5
c=4
4.
if (x<0)
{
z = x*(-1)
}
else
{
z=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
if(score<0)
{
printf("count = %d\n",count);
}
count++;
scanf("%d",&score);
0.
#include <stdio.h>
int main(void)
{
int yu=10000,year=1;
float c_yu,n_yu=0.0,hei=10000;
while (1)
{
c_yu = yu*0.1;
n_yu += c_yu;
hei = hei*(1+0.05);
if (hei>(n_yu+yu))
{
printf("%d年后,黑夜投资额超过小甲鱼!\n",year);
printf("小甲鱼投资额为:%.2f\n",n_yu+yu);
printf("黑夜投资额为:%.2f\n",hei);
break;
}
year++;
}
}
1.
#include <stdio.h>
int main(void)
{
int year=1;
float a = 4000000;
while(1)
{
a -= 500000;
a = a*(1+0.08);
if (a<=0)
{
printf("%d年后,败光家产!\n",year);
break;
}
year++;
}
return 0;
}
2.
3.
#include <stdio.h>
int main(void)
{
int m=24,a1=1,a2=1,a3;
while (m-2>0)
{
a3 = a1+a2;
a1 = a2;
a2 = a3;
m -= 1;
}
printf("%d",a3);
return 0;
} |
|