|
发表于 2017-7-18 22:08:51
|
显示全部楼层
0.100
1.0次
2.a,b,c
3.a=12 b=5 c=9
4.
(1)
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
(2)
if (ibex > 14)
{
sheds = 3;
help = 2 * sheds;
}
else
{
sheds = 2;
help = 2 * sheds;
}
(3)
while(1)
{
scanf("%d", &score);
if (score < 0)
{
printf("count = %d\n", count);
break;
}
count++;
continue;
}
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int count_year=0;
- long long JiaYu=10000,XiYe=10000;
- while (1)
- {
- if(JiaYu+1000<=XiYe*1.05)
- {
- break;
- }
- else
- {
- JiaYu+=1000;
- XiYe*=1.05;
- count_year+=1;
- }
- }
- printf("After %d years, XiYe is richer than Mr. JiaYu. Whoa!",count_year);
- return 0;
- }
复制代码
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- long money=4000000;
- int count_year=0;
- while(1)
- {
- if(money-500000<=0)
- {
- break;
- }
- else
- {
- money-=500000;
- money*=1.08;
- count_year+=1;
- }
- }
- printf("%d",count_year);
- return 0;
- }
复制代码
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- double q_pi=0;
- int temp=1;
- while(1)
- {
- if(1.0/temp<=0.0000001 && 1.0/temp>=-0.00000001)
- {
- break;
- }
- else
- {
- if((temp-1)%4)
- {
- q_pi-=1.0/temp;
- }
- else
- {
- q_pi+=1.0/temp;
- }
- temp+=2;
- }
- }
- //printf("%d\n",temp);
- printf("%f",q_pi*4);
- return 0;
- }
复制代码
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int count=1;
- int t1=1,t;
- int result=0;
- for(count=1;count<=20;count++)
- {
- if(count==1)
- result=1;
- if(count==2)
- result=1;
- if(count>=3)
- {
- t=result;
- result+=t1;
- t1=t;
- }
- }
- printf("%d",result);
- return 0;
- }
复制代码 |
|