//13. 2006年培养学员8万人,每年增长25%,请问按此增长速度,
// 到哪一年培训学员人数将达到20万人?
public class Demo13{
public static void main(String[] args){
//确定从2006年开始 每年增长25% 到那一年人员超过20万
//无法确定满足条件时 需要计算多少次
double personCount = 8;
int year = 2006;
while(true){
year++;
personCount = personCount + personCount * 0.25;
if(personCount>=20){
break;
}
}
System.out.println(year);
}
}
网友评论