factorial.cpp
来自「Data Abstraction & Problem Solving with 」· C++ 代码 · 共 16 行
CPP
16 行
int factorial(int n)// ------------------------------------------------------// Computes the factorial of an integer.// Precondition: n >= 0.// Postcondition: Returns n * (n-1)*...*1, if n > 0;// returns 1 if n = 0.// ------------------------------------------------------{ int fact = 1; for (int i = n; i > 1; --i) fact *= i; return fact;} // end factorial
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?