Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1.  
  2. #include<iostream>
  3. using namespace std;
  4.  
  5. int silnia (int x)
  6. {
  7.  
  8. if (x == 0) return 1;
  9. else return x*silnia(x-1);
  10. }
  11.  
  12. int main()
  13. {
  14. int a;
  15. cout << "Obliczanie silni z ";
  16. cout << "Podaj liczbe: ";
  17. cin >> a;
  18. cout << a << "! = " << silnia(a) << endl;
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement