[问题] 103中正资管loop invariant

楼主: aqeghkmb (瓜)   2017-05-21 00:14:12
which of the following is a loop invariant at the point at which the test for
termination is performed in the following loop structure?
X=3
while(X<5):X=X+2
A.X≦5 B.X<5 C.X≧5 D.X>5
这题答案给D
我上网查了loop invariant 大概是一个叙述在执行前和执行后皆为true 不知道理解有没
有错 但这题看不懂为什么是D 如果皆为true的话我觉得是A
求神人~

Links booklink

Contact Us: admin [ a t ] ucptt.com