斐波那契数列程序
#include<stdio.h>int f(int n)
{
int f;
if(n==1||n==2)
f=1;
else
f=f(n-1)+f(n-2);
return f ;
}
void main()
{
int n;
printf("please input the month n:\n");
scanf("%d",&n);
printf("the %dth month of the rabits is %d\n",n,f(n));
}我觉得程序没问题,但老有下面的错误,哪位帮忙看一下,O(∩_∩)O谢谢!
E:\xyq\11.cpp(10) : error C2064: term does not evaluate to a function
E:\xyq\11.cpp(10) : error C2064: term does not evaluate to a function
Error executing cl.exe.
[ 本帖最后由 宁静的夏天 于 2010-7-9 17:46 编辑 ]