#include <stdio.h>
int main()
{
intday,x1,x2; /*定义 day、x1、x2 3 个变董为基本整型*/
day=9;
x2=1;
while(day>0)
{
x1=(x2+1)*2; /*第一天的桃子数是第二天桃子数加1后的2倍*/
x2=x1;
day--; /*因为从后向前推所以天数递减*/
}
printf("the total is %d\n",x1); /* 输出桃子的总数*/
return 0;
}
the total is 1534
版权说明:Copyright © 广州松河信息科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州松河信息科技有限公司 版权所有