提交 bc8e8dfc 编写于 作者: A Akshay Gupta 提交者: Christian Clauss

factorial.cpp (#561)

* Create factorial.cpp

* Update and rename Math/factorial.cpp to math/factorial.cpp

* Update factorial.cpp

* Update factorial.cpp
上级 b53bdf16
// C++ program to find factorial of given number
#include<iostream>
// function to find factorial of given number
unsigned int factorial(unsigned int n) {
if (n == 0)
return 1;
return n * factorial(n - 1);
}
// Driver code
int main() {
int num = 5;
std::cout << "Factorial of " << num << " is " << factorial(num)
<< std::endl;
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册