how can i write a programs which prints the following pattern, but by only using nested loop

*
***
*****
*******
*****
***
*

1 个评论

MAKE AN EFFORT. We don't do your homework. If and when you actually have a question, then ask it. Show what you are doing, what is your problem, then ask a question.

回答(1 个)

A = [' * ';...
' *** ';...
' ***** ';...
' *******';...
' ***** ';...
' *** ';...
' * '];
for ii = 1:1
for jj = 1:1
disp(A)
end
end

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by