练习5

  

// Fibonaqi.cpp : Defines the entry point for the console application.
/*
data:2013/10/05
auth:ljz
func:
斐波那契Fn的递归函数
*/

#include "stdafx.h"
#include "iostream"
using namespace std;
int Fibonaqi(int n)
{
if (n == 1 || n == 2)
{
return 1;
}
else
{
return ( Fibonaqi(n-1)+Fibonaqi(n-2) );
}
}
int main(int argc, char* argv[])
{
int m;
printf("输入一个数!\n");
cin>>m;
cout<<Fibonaqi(m)<<endl;
return 0;
}

 

posted @ 2013-10-05 20:39  呱呱老师  阅读(188)  评论(0编辑  收藏  举报