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(\"* * * * * *\ \")

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 ne

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site