Converting for loop to while loop

1 visualización (últimos 30 días)
Dominic Garcia
Dominic Garcia el 21 de Oct. de 2020
Comentada: Dominic Garcia el 22 de Oct. de 2020
Need it as quick as possible Please, thanks

Respuesta aceptada

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam el 21 de Oct. de 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

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by