有关递归调用,大家帮忙看看程序哪里错了
#include <stdio.h>#include<math.h>
double f(int n);
int main(void)
{
int n;
double y;
printf("please enter n:");
scanf("%d",&n);
y=f(n);
printf("the answer is %f\n",y);
return 0;
}
double f(int n)
{
double result;
if (n==1)
result=28;
else
result=f(n-1)-1/100*sqrt(783);
return result;
}
我运行的结果都是28,谁能告诉我为什么啊?