Advertisement
KarolWozniak

Zadanie 11

Mar 31st, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. int liczba1;
  6.  
  7. int SILNIA(int a)
  8. {
  9.     if(a<2)
  10.     {
  11.         return 1;
  12.     }
  13.  
  14.     return a*SILNIA(a-1);
  15. }
  16.  
  17. int main()
  18. {
  19.  
  20.     cout << "Podaj liczbe naturalna: ";
  21.     cin >> liczba1;
  22.     cout << "Silnia z liczby !" << liczba1 << " wynosi: " << SILNIA(liczba1);
  23.  
  24.     return 0;
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement