使用for循环
#include <stdio.h>
int main() {
int peaches = 1;
for(int day = 9; day >= 1; day--) {
peaches = (peaches + 1) * 2;
}
printf("The monkey picked %d peaches on the first day.\n", peaches);
return 0;
}
使用for循环
#include <stdio.h>
int main() {
int peaches = 1;
for(int day = 9; day >= 1; day--) {
peaches = (peaches + 1) * 2;
}
printf("The monkey picked %d peaches on the first day.\n", peaches);
return 0;
}