Advertisement
neogz

REK - Faktorijel

Aug 20th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. /*
  2.         Faktorijel broja.
  3. */
  4.  
  5. #include <iostream>
  6. using namespace std;
  7.  
  8.  
  9. int rfakt(int broj)
  10. {
  11.     if (broj <= 1) return 1;
  12.     return broj * rfakt(broj - 1);
  13. }
  14. int main(){
  15.  
  16.     int broj;
  17.     cout << "Unesite broj: ";
  18.     cin >> broj;
  19.  
  20.     cout << "Faktorijel " << broj << " = " << rfakt(broj) << endl;
  21.    
  22.     system("pause>null");
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement