n!
来源:互联网 发布:新域名后缀 编辑:程序博客网 时间:2024/04/27 22:27
#include<iostream>
using namespace std;
double fun(int x)
{
if(x<0)
return 0.0;
else if(x==0)
return 1;
else
return x*fun(x-1);
}
int main()
{
int n;
for(;;)
{
cout<<"Please input the positive integer:"<<endl;
cin>>n;
if(n<0)
break;
else
cout<<"The result is:"<<fun(n)<<endl;
}//end for(;;)
cout<<"Thank you for using!"<<endl;
}
using namespace std;
double fun(int x)
{
if(x<0)
return 0.0;
else if(x==0)
return 1;
else
return x*fun(x-1);
}
int main()
{
int n;
for(;;)
{
cout<<"Please input the positive integer:"<<endl;
cin>>n;
if(n<0)
break;
else
cout<<"The result is:"<<fun(n)<<endl;
}//end for(;;)
cout<<"Thank you for using!"<<endl;
}
0 0
- N!
- N!
- n
- N
- N!
- N!
- N!
- N!
- n!
- N!
- N!
- N!
- N!
- n
- N!
- N!
- N!
- n!
- GridView各种属性小结
- sdut2408 pick apples (贪心+背包)山东省第三届ACM省赛
- zend studio 字体大小修改,默认编码设置
- Qt: 释放窗口资源
- error link 2019问题
- n!
- Hive函数之parse_url
- java iterator
- 看不到天花板?机器人产业奔向黄金时代
- this
- 黑马程序员学习笔记——关于时间复杂度计算2
- ListVew与Adapter
- Timus 1601. AntiCAPS 修正大写句子
- uva 10668(计算几何+二分)