I was wondering if anyone could help me answer this question. It is from a previous exam paper and I could do with knowing the answer ready for this years exam.
This question seems so simple that I am getting completely lost, what exactly is it asking for?
Consider the following section of code involving integer variables:
if (i < j) { m = i; } else { m = j; }
By stating an appropriate output condition and then verifying the correctness of the piece of code, prove that after execution, m is equal to the minimum of i and j.
I have got the post condition as: {m = i ∧ i < j ∨ m = j ∧ j < i}
is this correct? and how do you verify this?