Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Using the while loop function

1 visualización (últimos 30 días)
Jose Grimaldo
Jose Grimaldo el 5 de Oct. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
How do i make a while loop to loop five times if the user does not enter the correct input?

Respuestas (1)

Pavel Osipov
Pavel Osipov el 5 de Oct. de 2019
Editada: Rik el 5 de Oct. de 2019
fa1=false;
%fa2=true;
k=0;
while k<5
k=k+1;
if fa1==false
disp('you answer is bad, try again. ');
disp('attempt = ');disp(5-k);
else
disp('you answer is good');
break;
end%if
end%while
  4 comentarios
Pavel Osipov
Pavel Osipov el 6 de Oct. de 2019
Thank you, but I don't seem to have hurt you.
darova
darova el 6 de Oct. de 2019
Baby don't hurt me

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by