修改文件结构。
This commit is contained in:
17
POP/03/Exercise03.c
Normal file
17
POP/03/Exercise03.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int nextMonth(int currentMonth, int lastMonthAdult, int lastMonthChild) {
|
||||
if (currentMonth == 7) {
|
||||
return lastMonthAdult + lastMonthChild;
|
||||
}
|
||||
else {
|
||||
return nextMonth(currentMonth + 1, lastMonthAdult + lastMonthChild, lastMonthAdult);
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int sheepCount = 0;
|
||||
sheepCount = nextMonth(1,0,2);
|
||||
printf("Number of sheep: %d\nValue: %d", sheepCount, sheepCount*10);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user