% Compute nth term in an arithmetic sequence given first term, common
% difference (d) and n
%
% First term = 1, common difference = 3
% 1, 4, 7, 10, 13, 16, 19, 22, 25,.....
% 4 - 1 = 3
% 7 - 4 = 3
%
% nth term = first term + (n-1)*d
% Start Clean
clear
close all
% If you have a lot of unfamiliar formulas, it can help to
% include a variable dictionary. This is used to define
% what the variables mean.
% ft = first term
% d = common difference
% n = desired number term
ft = input('Input first term ');
d = input('Input common difference ');
n = input('Input desired term ');
nterm = ft + (n-1)*d
% Input first term 1
% Input common difference 3
% Input desired term 6
% nterm =
% 16