*All rightreserved.
*文件名称:test.cpp
*作 者:张明宇
*完成日期:2016年3月27日
*/
问题及代码:
写出求1*3*....*n的递归式并编写出递归函数求解。
#include <iostream>
using namespace std;
long int func1(int n);
int main()
{
int n,y;
cin>>n;
y=func1(n);
cout<<y<<endl;
return 0;
}
long int func1(int n)
{
long int f;
if(n==1)
f=1;
else
f=n*func1(n-2);
return f;
}