Last active
August 14, 2020 15:11
-
-
Save Rooarii/ec0f2a2acac0b7f2eee95cce3e792dbc to your computer and use it in GitHub Desktop.
pseudo-code algorithm returning the number of candy you can buy
This file contains 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
start buyCandies (real money, real price) | |
integer boughtCandies = 0 | |
while ((money and price > 0) and money >= price) | |
| | |
| money <- money - price | |
| boughtCandies <- boughtCandies + 1 | |
| | |
end while | |
return boughtCandies | |
End buyCandies |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment