PiDPC

Silnia

Nov 30th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int sil(int n) {
  6.     int reto=1;
  7.     for(int i=1;i<=n;i++) {
  8.         reto *= i;
  9.     } return reto;
  10. }
  11.  
  12. int main() {
  13.     int n;
  14.     cout << "Podaj n: ";
  15.     cin >> n;
  16.  
  17.     cout << "Silnia(n) = " << sil(n);
  18.     return 0x0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment