Finished Chapter 4

This commit is contained in:
WGAVermeer
2026-03-10 13:05:37 +01:00
parent 059f9724c4
commit 61da31dcdc
5 changed files with 364 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
function M(x: int, b: bool): int
decreases !b
{
if b then x else M(x + 25, true)
}
function N(x: int, y: int, b: bool): int
decreases x, b
{
if x <= 0 || y <= 0 then
x + y
else if b then
N(x, y + 3, !b)
else
N(x - 1, y, true)
}