/*。
*Copyright(c)2014,烟台大学计算机学院
*All right reserved,
*文件名:test.cpp
*作者:biyutang
*完成日期:2014年11月15日
*版本号:v1.0
*
问题描述:
*输入描述:输入x
*程序输出:输出Y
*/
#include <iostream>
using namespace std;
int fac(int x);
int main()
{
int n;
cout<<"输入奇数:"<<endl;
cin>>n;
cout<<n<<"的奇数阶乘为:"<<fac(n)<<endl;
return 0;
}
int fac(int x)
{
int y;
if(x==1)
return (1);
else
y=x*fac(x-2);
return(y);
}
运行结果: