int main(int argc, const char * argv[])
{
int peach_num = 1;//第十天桃子数量
int day = 10;
for (; day>1; day--) {
printf("第%d天,peach_num = %d\n", day,peach_num);
peach_num = (peach_num + 1) * 2;
}
printf("第%d天,peach_num = %d\n", day,peach_num);
return 0;
}
希望对你思路有帮助 |