Matlab function solve number pattern
Show older comments
Please some one help me in this number pattern How to write this code?
Answers (1)
Doddy Kastanya
on 12 Jan 2021
0 votes
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
Categories
Find more on MATLAB Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!