#Day75 #100DaysChallenge- Matlab Loops|Hollow Triangle Pattern 3
#Day75-Hollow Triangle Pattern 3
Matlab code
function hollow_triangle_pattern3(x)
k=1;
for i=x:-1:1
for sp=1:1:k
fprintf('\t');
end
for j=1:1:i
if j==1||j==i||i==x
fprintf('\t');
fprintf('*');
fprintf('\t');
else
fprintf('\t');
%fprintf('\t');
fprintf('\t');
end
end
k=k+1;
fprintf('\n');
end
Sample Input and Output
>> hollow_triangle_pattern3(5)
* * * * *
* *
* *
* *
*
>> hollow_triangle_pattern3(3)
* * *
* *
*
No comments