为什么乘以1/2这种事不对的啊
#include
int rep(int n) { int sum; if (n == 10) sum = 1; else sum = 1/2*(rep(n-1))-1;//为什么不对啊 return sum; } int main(void ) { int i; for(i=1;i<11;i++) printf("第%d天还有%d个水果\n",i,rep(i)); return 0; }#include
int rep(int n) { int sum; if (n == 10) sum = 1; else sum = 1/2*(rep(n-1))-1;//为什么不对啊 return sum; } int main(void ) { int i; for(i=1;i<11;i++) printf("第%d天还有%d个水果\n",i,rep(i)); return 0; }2016-01-26
举报