Advertisement
Josif_tepe

Untitled

Mar 10th, 2021
99
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 <algorithm>
  3. using namespace std;
  4.  
  5. int faktoriel(int n) {
  6.     int proizvod = 1;
  7.     for(int i = 1; i <= n; i++) {
  8.         proizvod *= i;
  9.     }
  10.     return proizvod;
  11. }
  12. int main()
  13. {
  14.     int n;
  15.     cin >> n;
  16.     cout << faktoriel(n) << endl;
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement