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:0.9 StartHTML:0000000105 EndHTML:0000006588 StartFragment:0000000141 EndFragment:0000006548
In questions 1 and 2, 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 :
()={
1,
if
=
0
(
1
)
,
if
>
0
1. 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.
2. 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!