Advertisement
olaaa

Untitled

Nov 12th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. float fun(float p, int w) {
  6. //p^w
  7. if (w == 0) {
  8. return 1;
  9. }
  10. else {
  11. return p = p * fun(p, --w);
  12.  
  13. }
  14.  
  15. }
  16. int main()
  17. {
  18. float p, wynik;
  19. unsigned int w;
  20. cin >> p >> w;
  21. wynik = fun(p, w);
  22. cout << wynik << endl;
  23.  
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement