Advertisement
pan7nikt

potegaRekurencyjny

Feb 25th, 2020
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. unsigned input;
  5. unsigned liczba;
  6.  
  7. unsigned long long pow(unsigned n, unsigned a)
  8. {
  9.     if(n==0){return 1;}
  10.     return pow(n-1, a) * a;
  11. }
  12.  
  13. int main()
  14. {
  15.     cout << "jaka liczba?: ";
  16.     cin >> liczba;
  17.     cout << "do jakiej potegi?: ";
  18.     cin >> input;
  19.     cout << pow(input, liczba) << endl;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement