Whileloop output calculation?

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

Torsten
Torsten 2023년 5월 21일
Test it. And use StrgC to stop the run.
Walter Roberson
Walter Roberson 2023년 5월 21일
control-c maybe?
Torsten
Torsten 2023년 5월 21일
German keyboard.

댓글을 달려면 로그인하십시오.

답변 (1개)

Dongyue
Dongyue 2023년 5월 25일

1 개 추천

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.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

질문:

2023년 5월 21일

답변:

2023년 5월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by