📄 factory01.cpp
字号:
//=====================================
// title: 阶乘(循环方法Iterative Implementation)
// author: cjj
// date: 2007-09-29
//=====================================
#include <iostream>
using namespace std;
int main()
{
for (int n; cin >> n;)
{
int factory = 1;
if (n == 0)
cout << n << "! = " << 1 << endl;
else
{
for (int i = 1; i <= n; i++)
{
factory *= i;
}
cout << n << "! = " << factory << endl;
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -