package task_3_7;
public class Task04 {
public static void main(String[] args) {
// 猴子摘桃
// 一天吃一半多1个,到第十天剩下1个,求第一天有几个。
// 使用while语句
// 10 9 8 7 ...
// 1 4 10 22 ...
int i = 10; //第几天
int peachCount = 1; //桃子个数
while(i >= 1) {
peachCount = (peachCount+1)*2;
i--;
}
System.out.println(peachCount);
}
}