0
b) sum = 0; count = 1; repeat (add count to sum; add 1 to count); until (sum > 5000) or (count = 40);
Answer:
mov sum, 0
mov ecx, 1
untilB: add sum, ecx
inc ecx
cmp sum, 5000
**what comes after this?**
enduntilB:
那麼我應該爲每個條件使用什麼樣的跳轉語句(總和> 5000或計數= 40)?如何在彙編語言的語句之前執行此操作?
另外:
c) sum = 1000; for count = 100 downto 50 (subtract (2 * count) from sum); end for;
Answer:
mov sum, 1000
mov ecx, 100
forC: cmp ecx, 50
jnge endforC
**what comes after this?**
dec ecx
jmp forC
endforC: