Q1 Please answer ABand C thanks in advance The following que

Q1. Please answer A,B,and C... thanks in advance.

The following questions refer to the code shown below: What is the weakest precondition for this code and the given post condition? Give an invariant that is strong enough to prove the partial correctness of the loop. Make your invariant as weak as possible. Give an invariant that is strong enough to prove the total correctness of the loop.

Solution

a) the Weakest precondition is count=n

b) Stoing invariant is sum=sum+count

c) count=count-1

Q1. Please answer A,B,and C... thanks in advance. The following questions refer to the code shown below: What is the weakest precondition for this code and the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site