6 Print a matrix of 5 by 6 stars using MATLAB under the fol
6.) Print a matrix of 5 by 6 stars (\'*\') using MATLAB under the following guidelines.
a) Use a nested loop
b) Use fprintf command. (Hint use \ line feed as needed)
Solution
a)
for i=1:5
for j=1:6
disp(\"*\")
end
disp(\"\ \")
end
b)
fprintf(\"* * * * * *\ \")
fprintf(\"* * * * * *\ \")
fprintf(\"* * * * * *\ \")
fprintf(\"* * * * * *\ \")
fprintf(\"* * * * * *\ \")
