I'm having trouble understanding the logic behind Hoare Triples. The question asks for the missing value of the precondition {X}
{X}
if (b mod 2 <> 0)
t = 1
else
t = 0
{t = b – 2*(b div 2)}
Any help would be amazing!
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this community
mod
anddiv
. You might get away with the empty precondition (which always holds). $\endgroup$