#Day27 #100DaysChallenge- Matlab Loops| Printing Greater Than symbol
#Day27-Printing Greater than Symbol
Task:
Print Greater than symbol as shown below by taking user input for number of lines.
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
Matlab Code:
function
greaterthansymbol(x)
for i=1:1:x
for j=1:1:i
fprintf('\t')
end
fprintf('@')
fprintf('\n');
end
for i=x:-1:1
for j=1:1:i
fprintf('\t')
end
fprintf('@')
fprintf('\n');
end
end
Sample Input and Output
>> greaterthansymbol(7)
@
@
@
@
@
@
@
@
@
@
@
@
@
@
>> greaterthansymbol(5)
@
@
@
@
@
@
@
@
@
@
Join us on Facebook Group:
https://www.facebook.com/groups/matlabcodes
No comments