clear; clc;

balance = 100;
r = 0.18;
goal = 200;

% years = 0;
% while balance < goal
%     balance = balance * (1 + r);
%     years = years + 1;
% end

for years = 1 : inf
    balance = balance * (1 + r);
    if balance >= goal
        break;
    end
end
balance
years

