Lesson 6
This commit is contained in:
12
06/Optional01.c
Normal file
12
06/Optional01.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user