Mathlab program solving answr below

1 次查看(过去 30 天)
Hakim
Hakim 2022-8-20
移动Image Analyst 2022-8-21
I want me to reVerse out put what will Be the math lab program looK Like,
n=5
n = 5
for i=1:n
for j=1:i
fprintf('%d', i)
end
fprintf('\n')
end
122333444455555
  7 个评论
Hakim
Hakim 2022-8-20
编辑:John D'Errico 2022-8-21
(By now, you should understand the difference between a comment and an answer. I moved your answer to a comment.)
I want 5 4 4 3 3 3 2 2 2 2 1 1 1 1 1

请先登录,再进行评论。

回答(2 个)

Jan
Jan 2022-8-20
Maybe you want to replace
for i = 1:n
by
for i = n:-1:1

Torsten
Torsten 2022-8-20
移动:Image Analyst 2022-8-21
n = 5;
for i=n:-1:1
for j=n:-1:i
fprintf('%d', i)
end
fprintf('\n')
end
544333222211111

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by