Mathlab program solving answr below

4 visualizzazioni (ultimi 30 giorni)
Hakim
Hakim il 20 Ago 2022
Spostato: Image Analyst il 21 Ago 2022
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 Commenti
Hakim
Hakim il 20 Ago 2022
5 4 4 3 3 3 2 2 2 2 1 1 1 1 1
Hakim
Hakim il 20 Ago 2022
Modificato: John D'Errico il 21 Ago 2022
(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

Accedi per commentare.

Risposte (2)

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

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

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by