clear; clc;

balance = 100;
r = 0.1;
goal = 200;

holding_years = 0;

while balance < goal
    balance = balance * (1 + r);
    holding_years = holding_years + 1;
end

balance
holding_years