Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // faktorijel rekurzijom
- #include <iostream>
- using namespace std;
- int funkcija(int n)
- {
- if (n > 1)return n*funkcija(n - 1);
- else return 1;
- }
- int main()
- {
- int n;
- cout << "Unesi broj da izracunam faktorijel: ";
- cin >> n;
- cout << "Faktorijel od broja" << n<< "! je = " << funkcija(n);
- system("pause >nul");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment