neogz

faktorijel

Nov 19th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.  
  5.     double faktorijel = 1;
  6.     int broj;
  7.  
  8.     cout << "Unesite broj od kojeg zelite izracunati faktorijel. ";
  9.     cin >> broj;
  10.  
  11.     for (int i = 1; i <= broj; i++) faktorijel *= i;
  12.     cout << "Faktorijel broja " << broj << "! iznosi: " << faktorijel;
  13.  
  14.  
  15.     system("pause > nul");
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment