Created
April 26, 2019 04:13
-
-
Save riceluxs1t/3864412a8ce7f9d5ffa7c1f38fde8291 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
method Divide(x: nat, y: nat) returns (q: nat, r: nat) | |
requires y > 0; | |
ensures q * y + r == x && r >= 0 && r < y; | |
{ | |
q := 0; | |
r := x; | |
while (r >= y) | |
{ | |
r := r - y; | |
q := q + 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment