Complete this form and hit the "Save Changes" button!
No ratings
Are you sure you want to delete this code? Please type DELETE in the box below to confirm.
Are you sure you want to verify this code?
Are you sure you want to publish this code?
Are you sure you want to unpublish this code?
Are you sure you want to autogenerate the summary + description for this code?
xxxxxxxxxx
method Eval(x:int) returns (r:int) // do not change
requires x >= 0
ensures r == x*x
{ // do not change
var y:int := x; // do not change
var z:int := 0; // do not change
while y>0 // do not change
invariant 0 <= y <= x && z == x*(x-y)
decreases y
z := z + x; // do not change
y := y - 1; // do not change
} // do not change
return z; // do not change