SHARE
TWEET

Untitled

olaaa Nov 12th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. float potega(float p, int w) { //p^w
  6.    
  7.     if (w == 0) {
  8.         return 1;
  9.     }
  10.     else {
  11.         return p = p * potega(p, --w);
  12.  
  13.         }
  14.    
  15. }
  16. int main()
  17. {
  18.     float p, wynik;
  19.     unsigned int w;
  20.     cin >> p >> w;
  21.     wynik = potega(p, w);
  22.     cout << wynik << endl;
  23.  
  24. return 0;
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top