Advertisement
ali_aboshady

Untitled

Dec 5th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int tak(int x,int y,int z)
  5. {
  6. if (y>=x)
  7. {
  8. return y;
  9. }
  10. else
  11. {
  12. return tak(tak(x-1,y,z),tak(y-1,z,x),tak(z-1,x,y));
  13. }
  14. }
  15.  
  16. int main()
  17. {
  18. int x, y, z;
  19. for (int i=0; i<20; i++)
  20. {
  21. x=i;
  22. y=0;
  23. z=i+1;
  24. cout<<tak(x,y,z)<<endl;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement