How do I convert from a while loop to a for loop?

1 vue (au cours des 30 derniers jours)
Jillian Sweatt
Jillian Sweatt le 4 Nov 2015
i = 0;
while (i < 110)
fprintf('i = %d\n',i)
i = i + 11;
end

Réponse acceptée

James Tursa
James Tursa le 4 Nov 2015
for i=0:11:109
fprintf('i = %d\n',i)
end

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by