Exercise 13 Solution

clear;
N = 9;
for n = 1:N,
    % create string on the left
    ss = [];
    for j = 1:n,
        ss = [ss num2str(j)];
    end
    
    % create string on the right
    rr = [];
    for j = N:-1:N-n+1,
        rr = [rr num2str(j)];
    end
    
    % create and output full string
    strn = [ ss ' x 8 + ' num2str(n) ' = ' rr ];
    fprintf('%s\n',strn);
end


For more details, please contact me here.