Advertisement
MeehoweCK

Untitled

Jul 16th, 2018
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. // wywołanie rekurencyjne funkcji - wywołanie funkcji wewnątrz samej siebie
  6.  
  7. unsigned long long silnia(unsigned n)    // funkcja zwracająca liczbę całkowitą z pobranej liczby całkowitej
  8. {
  9.     if(n == 0 || n == 1)    // "jeżeli n jest równe 0 lub 1":
  10.         return 1;
  11.     return n * silnia(n - 1);
  12. }
  13.  
  14. int main()
  15. {
  16.     cout << silnia(6) << endl;
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement