Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.20 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int factorial(int n) {
  4.     if (n == 0) {
  5.         return 1;
  6.     }
  7.     return n * factorial(n – 1);
  8. }
  9. int main()
  10. {
  11.     int b;
  12.     cin >> b;
  13.     cout << factorial(b);
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement