Whileloop output calculation?

4 visualizzazioni (ultimi 30 giorni)
Entle
Entle il 21 Mag 2023
Risposto: Dongyue il 25 Mag 2023
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 Commenti
Walter Roberson
Walter Roberson il 21 Mag 2023
control-c maybe?
Torsten
Torsten il 21 Mag 2023
German keyboard.

Accedi per commentare.

Risposte (1)

Dongyue
Dongyue il 25 Mag 2023
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.

Categorie

Scopri di più su Desktop 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