1、核心代码如下
2、debug:eclipse
Scanner isr = new Scanner(System.in);
System.out.println("输入需要计算的次数");
int baseNum = 1;
int power = 1;
int cnt = 1;
int times = isr.nextInt();
do
{
if(cnt > 1)
baseNum += power;
power *= 2;
cnt++;
}while(cnt <= times);
System.out.println(baseNum);
3、追加悬赏了?还有什么问题吗