递归法求阶乘

#include <iostream>
using namespace std;
// 递归法求阶乘
int funcfactorial(int a)
{
	if (a<2)
	{
		return 1;
	}
	return a*funcfactorial(a-1);
}

int main()
{
	int a ;
	cin >> a;
	cout << funcfactorial(a)<<endl;
	return 0;
}

  

posted on 2013-10-12 20:14  Lingc·  阅读(229)  评论(0编辑  收藏  举报

导航

不知道不知道 知道不知道 知道知道 不知道知道。
天道酬勤,同志们共同努力!