Created
February 25, 2018 05:24
-
-
Save zetashift/9a7a009c58bfcc852c90446d4329e38a to your computer and use it in GitHub Desktop.
Growth of Population
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
proc nbYear*(p0: int, percent: float64, aug: int, p: int): int = | |
var count = 0 | |
var pop = p0 | |
while pop != p: | |
count = count + 1 | |
pop = pop + p0 * (percent / 100.float).int + aug | |
return count | |
echo(nbYear(1000, 5, 50, 2000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment