Matlab function solve number pattern

4 ビュー (過去 30 日間)
amir zmn
amir zmn 2021 年 1 月 10 日
回答済み: Doddy Kastanya 2021 年 1 月 12 日
Please some one help me in this number pattern How to write this code?
  1 件のコメント
amir zmn
amir zmn 2021 年 1 月 10 日
Check the image

サインインしてコメントする。

回答 (1 件)

Doddy Kastanya
Doddy Kastanya 2021 年 1 月 12 日
The following code listing should do it (ignore the zeros in the output):
cnt=0;
for i=1:5
for j=1:i
cnt=cnt+1;
y(i,j)=cnt;
if cnt==12
break
end
end
end
y

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by