Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. void silnia(int x)
  7. {
  8.     if(x==0)
  9.     {
  10.     return 1;
  11.     }else{
  12.     return x*silnia(x - 1)
  13.     }
  14. }
  15.  
  16. int main()
  17. {
  18. int a;
  19. cout << "podaj liczbe ";
  20. cin >>a;
  21.  
  22. cout <<silnia(a);
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement