Question: PRE - condition: n > = 0 1 . long square ( int n ) { 2 . if ( n = = 0 )
PREcondition: n
long squareint n
if n return ;
return squaren n;
POSTcondition: Return the quantity n n
In other words, assuming N n the square algorithm should return N
Let PN squareN returns N for any integers N
Use PN as its defined to prove, using strong mathematical induction, that square
correctly satisfies the POSTcondition
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
