Question: Version: 0 . 9 StartHTML: 0 0 0 0 0 0 0 1 0 5 EndHTML: 0 0 0 0 0 0 6 5 8
Version: StartHTML: EndHTML: StartFragment: EndFragment:
In questions and we will create a program that calculates the factorial of natural number and stores the result
as Here, function is the function that gives the factorial of :
if
if
Answer the following questions.
a What are the pre and post conditions needed for this program?
b Create a loop invariant by replacing the named constant by a variable in the postcondition what can
be the range of variable and create the corresponding loop condition
c Find a bound expression for this program. Show your work.
Create a full proof outline under the total correctness for this program. Dont forget to initialize variables and
before the loop starts, find reasonable values for them. Justify each logical implications used in the proof
outline.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
