clc, format compact, clear all; % Clear all temp variables
disp ('-------------------------------------------------------------')
disp (' ')
disp ('print pascal''s triangle')
disp (' ')
disp ('-------------------------------------------------------------')

lineCount=input( 'Please specify line count: ');
if size(lineCount)==0; % quit user enters null value
    lineCount = 200;
    break
end

if mod(lineCount,2) == 1  
        lineCount = lineCount + 1;
end

spaceCount = lineCount / 2 + 4;

current = [1];
prior=[];

fprintf ('\n\n\n\n')

while spaceCount > 0
    
% fprintf    
for i = 1:(3.4*spaceCount)
    fprintf (' ')
end

for i = 1:(numel(current)-1)
     fprintf (' %05d ', (current(i)))
end

fprintf (' %05d\n', (current(1)))
prior=current;
current=(1:(numel(prior)+1));

for i = 2:(numel(current)-2)
    current(i) = (prior(i-1)+prior(i));
end

spaceCount = spaceCount - 1;   
end


fprintf('\n\n\n')
% fprintf('\n\n\nline count...... %1.0f\n', lineCount)
% fprintf('space count.....  %1.0f\n', spaceCount)