#include <stdio.h>
int main()
{
int number=200;
int year=2014;
do
{
year++;
number+=number*0.2; //这里是不是应该写点什么?
}while(number<1000); //这里好像缺点什么
printf("到%d年招工规模突破1000人\n", year);
return 0;
}
没问题啊,我刚刚试了一下
number赋值的时候有问题
#include<stdio.h> int main() { int number=200; int year=2014; do { year++; number=number*1.2; }while(number<100); printf("到%d年招工规模突破1000人\n",year); return 0; }
number+=number*0.2相当于number=number+number*0.2相当于number=number*(1+0.2)