fork(1) download
  1. #include <stdio.h>
  2. int peach(int day)
  3. {
  4. if(day >= 10)
  5. return 1;
  6. return (peach(day + 1) + 1) * 2;
  7. }
  8. int main(void)
  9. {
  10. int days;
  11. printf("Input days:");
  12. scanf("%d", &days);
  13. printf("第%d天的桃子数为%d",days,peach(days));
  14. return 0;
  15. }
Success #stdin #stdout 0s 588KB
stdin
7
stdout
Input days:第7天的桃子数为22