1 /*
 2     2012年培养学员25万人,每年增长25%,请问按此增长速度,到哪一年培训的人缘达到100万人;
 3 */
 4 #include "stdio.h"
 5 
 6 int main()
 7 {
 8     int person = 250000;//2012年的学员人数
 9     for (int i = 2013; ; i++)
10     {
11         person += (person*0.25);//每年增加的人数
12         printf("%d年,%d人\n",i,person);//打印每年和每年人数
13         if (person>=1000000)//判断 若成立就输出该年
14         {
15             printf("%d年能达到%d人\n",i,person);
16             break;//由于条件不知道哪一年  达到就断开循环 结束程序。
17         }
18     }
19 
20 }

 

相关文章:

  • 2021-08-30
  • 2021-08-29
  • 2021-09-14
  • 2021-07-02
  • 2021-12-04
  • 2021-09-27
  • 2021-06-22
猜你喜欢
  • 2021-05-12
  • 2021-06-15
  • 2021-11-20
  • 2021-06-02
  • 2022-01-01
  • 2022-01-05
相关资源
相似解决方案