how can I create a triangle that includes 1,12,123,1234,1235
Mostrar comentarios más antiguos
when n=6, I want to make a pattern from 1:n, and it should printed like this(using for or while loops)
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
2 comentarios
James Tursa
el 23 de Dic. de 2015
This looks like homework again.
John D'Errico
el 23 de Dic. de 2015
Please stop asking the same question repeatedly. Asking the same question over and over again will not get you a better answer.
Respuestas (1)
James Tursa
el 23 de Dic. de 2015
You can start with this:
n = 6;
for k=1:n
% Fill in code here for the pattern for this iteration
end
So you need to fill in the code above, using either vectorized methods or perhaps using another loop.
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!