#include<stdio.h>
long int fact(int num);
long int rfact(int num);
int main(){
int num;
printf("please enter a num from 1-12:\n");
scanf("%d",&num);
// printf("The answer is %ld\n",fact(int num));
printf("The answer1 is %ld\n",fact(num));
// printf("The answer is %ld",rfact(int num));
printf("The answer2 is %ld",rfact(num));
return 0;
}
long int fact(int num){
int i;
long int j=1;
for(i=1;i<num;i++)
j=j*(i+1);
return j;
}
long int rfact(int num){
long int k=0;
if(num==1)
return k;
k=num*rfact(num-1);
}
这段代码为什么rfact函数的答案不正确呀