Advertisement
olaaa

Untitled

Nov 12th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement