#include using namespace std; /* fun_fun returns one more than it's paramter */ int fun_fun(int x){ return x + 1; } int main(){ int x = fun_fun(fun_fun(fun_fun(0))); // 3 calls, so it'll add 1 to 0 three times! // x should be 3 cout << x << endl; int y = 0; /* First Iteration: 0 < 3 (true) * Next: 2 < 4 (true) * Next: 4 < 5 (true) * Next: 6 < 6 (false) */ while(y < x){ cout << x << " " << y << endl; y = fun_fun(fun_fun(y)); x = fun_fun(x); } cout << "Final Values: " << x << " " << y << endl; return 0; } /* Output: * 3 * 3 0 * 4 2 * 5 4 * Final Values: 6 6 */