Using the while loop function
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
How do i make a while loop to loop five times if the user does not enter the correct input?
Antworten (1)
Pavel Osipov
am 5 Okt. 2019
Bearbeitet: Rik
am 5 Okt. 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 Kommentare
darova
am 5 Okt. 2019
Mr. Pavel, please use special button for code inserting
Pavel Osipov
am 6 Okt. 2019
Thank you, but I don't seem to have hurt you.
darova
am 6 Okt. 2019
Baby don't hurt me
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!