Converting for loop to while loop

34 visualizzazioni (ultimi 30 giorni)
Need it as quick as possible Please, thanks

Risposta accettata

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam il 21 Ott 2020
for i =1:5
j=1;
k=1;
while j<=5-i
fprintf(' ');
j = j+1;
end
while k<=i
fprintf('*');
k = k+1;
end
fprintf('\n')
end

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements 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