// 100_15.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int fibo1(int n)
{
	if(n==0)
		return 0;
	else if(n==1)
		return 1;
	
	int f0=0;
	int f1=1;
	int f2;
	for(int i=2;i<=n;i++)
	{
		f2 = f1+f0;
		f0=f1;
		f1=f2;
	}
	return f2;

}

int _tmain(int argc, _TCHAR* argv[])
{
	printf("%d\n",fibo1(8));
	return 0;
}

相关文章:

  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-08-11
  • 2021-12-09
  • 2022-12-23
  • 2022-01-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2022-01-05
  • 2021-12-24
  • 2021-12-05
  • 2021-08-21
相关资源
相似解决方案