Whileloop output calculation?
Afficher commentaires plus anciens
Given the matlab code below
x1=15; while x1>10 x1=x1*(x1+1); end disp(x1)
State the output that the code will yield.
3 commentaires
Torsten
le 21 Mai 2023
Test it. And use StrgC to stop the run.
Walter Roberson
le 21 Mai 2023
control-c maybe?
Torsten
le 21 Mai 2023
German keyboard.
Réponses (1)
Dongyue
le 25 Mai 2023
1 vote
The condition x1>10 is always true, making this while loop infinite. Consequently, the loop will continue indefinitely without producing any output since the disp(x1) command will never execute.
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!