Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- // wywołanie rekurencyjne funkcji - wywołanie funkcji wewnątrz samej siebie
- unsigned long long silnia(unsigned n) // funkcja zwracająca liczbę całkowitą z pobranej liczby całkowitej
- {
- if(n == 0 || n == 1) // "jeżeli n jest równe 0 lub 1":
- return 1;
- return n * silnia(n - 1);
- }
- int main()
- {
- cout << silnia(6) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement