Advertisement
Josif_tepe

Untitled

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