Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int tak(int x,int y,int z)
- {
- if (y>=x)
- {
- return y;
- }
- else
- {
- return tak(tak(x-1,y,z),tak(y-1,z,x),tak(z-1,x,y));
- }
- }
- int main()
- {
- int x, y, z;
- for (int i=0; i<20; i++)
- {
- x=i;
- y=0;
- z=i+1;
- cout<<tak(x,y,z)<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement