Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int faktorijel(int broj)
- {
- if (broj <= 1)
- return 1;
- else
- return broj*faktorijel(broj - 1);
- }
- void main()
- {
- int broj;
- cout << "Unesite broj od kojeg želite faktorijel: ";
- cin >> broj;
- cout << "Faktorijel unesenog broja je: " << faktorijel(broj) << endl;
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment