clc, format compact, clear all; % Clear all temp variables
disp ('----------------------------------------------------------------')
disp (' ')
disp ('Print two triangles of stars; exponents of 2 and increments of 2')
disp (' ')
disp ('----------------------------------------------------------------')


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


fprintf('\n\n\n')


lineCount  = lineCount * 2;
spaceCount = lineCount / 2;
starCount  = 1;
lineNum    = 1;


while spaceCount > 0

       
for i = 1:spaceCount
    fprintf (' ')
end
spaceCount = spaceCount - 1;


for i = 1:starCount
    if mod(i,2) == 1  
        fprintf ('*')
    end
    if mod(i,2) == 0  
        fprintf (' ')
    end
    
end

starCount = starCount + 2;

fprintf ('\n')

end

fprintf('\n\n\n')
% fprintf('space count  %1.0f\n', spaceCount)
% fprintf('star count %1.0f\n', starCount)





spaceCount = lineCount / 2;
starCount  = 1;
lineNum    = 1;

while spaceCount > 0

    
% fprintf    
for i = 1:spaceCount
    fprintf (' ')
end
spaceCount = spaceCount - 1;


for i = 1:starCount
        fprintf ('*')
end

starCount = starCount + 2;

fprintf ('\n')

end


fprintf('\n\n\n')

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