Advertisement
Kacper-p

zadanie

Sep 17th, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int F(int x,int n)
  4. {
  5. if (n==1)
  6. return x;
  7. else
  8. if (n%3==0)
  9. {int k=F(x,n/3);
  10. return k*k*k;}
  11. else
  12. return x*F(x,n-1);
  13. }
  14. int main()
  15. {
  16. cout<<F(2,10);
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement