#include <stdio.h>int remain(int i){ int j; if(i==10) j=1; else if(i<10&&i>0) j=(2*remain(i+1))+2; else if (i<=0) j=remain(1); else if(i>10) j=0; return(j);}void main(){int a,b;printf("please input the day you want to kown how many peach remained:\n");scanf("%d",&a);if(a>10)printf("The peach is eaten out.\n");else if(a<=0)printf("The peach is not eatean,so have %d peach.\n",remain(1));else { for(b=a;b>=1;b--) printf("The %d day reamins %d peach.\n",b,remain(b)); }}

评论