This commit is contained in:
unlockable
2022-10-27 14:03:17 +08:00
parent bf3b5851d3
commit 6e32ca4ba1
10 changed files with 257 additions and 0 deletions

12
06/Optional01.c Normal file
View File

@@ -0,0 +1,12 @@
#include <stdio.h>
int main() {
int apple[6] = {0};
int childCount = 4;
apple[5] = 11;
for (;childCount > 0; childCount--) {
apple[childCount] = (apple[childCount+1] * (childCount + 1) + 1)/childCount;
}
printf("Total number of apple: %d\n 1: %d\n 2: %d\n 3: %d\n 4: %d\n 5: %d\n", apple[1], apple[1]-apple[2], apple[2]-apple[3], apple[3]-apple[4], apple[4]-apple[5], apple[5]);
return 0;
}