Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- unsigned long long factorial(int n) {
- if (n<0)
- return 0;
- if (n==0)
- return 1;
- return n*factorial(n-1);
- }
- int main(void) {
- int n;
- cin >> n;
- cout<<"factorial("<<n<<")="<<factorial(n);
- system("pause");
- }
Add Comment
Please, Sign In to add comment