clc
clear

disp 'Taylor Waller'

k = 1;
total = 0;
terms = 0;
while total <= 10000
term = 3^k;
total = total + term;
terms = terms + 1;
k = k + 1;
end

fprintf('Number of terms: %d\n', terms);
fprintf('Sum of the terms: %.0f\n', total);

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: