请问这位兄弟为什么要在最后加个getch();有什么用呢??谢谢
可能是接收回车符,不过我想是多余的.
#include <stdio.h>
int Fibonacci(int n);
int main(void)
{
int n,i;
printf("\nHow many number you want to get:\t");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("%d ",Fibonacci(i));
}
printf("\n");
return 0;
}
int Fibonacci(int n)
{
if(n<=0)
{
return 0;
}
if(n==1||n==2)
{
return 1;
}
else
{
return (Fibonacci(n-1)+Fibonacci(n-2));
}
}
#include <stdio.h>
int Fibonacci(int n);
int main(void)
{
int n,i;
printf("\nHow many number you want to get:\t");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("%d ",Fibonacci(i));
}
printf("\n");
return 0;
}
int Fibonacci(int n)
{
if(n<=0)
{
return 0;
}
if(n==1||n==2)
{
return 1;
}
else
{
return (Fibonacci(n-1)+Fibonacci(n-2));
}
}
递归会不会太慢。