summaryrefslogtreecommitdiff
path: root/wk1/lab1/population.c
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2023-12-03 06:10:10 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2023-12-03 06:10:10 +0000
commit2edb0b5c21b754263477f5db336e49faf2fe40bd (patch)
treeaaf41626aad77ed8f40bfce5162d54be2a5f2e1b /wk1/lab1/population.c
parentde47e3e42cc2ea518e423d2617b7888f69a7e426 (diff)
Sat, Dec 2, 2023, 10:10 PM -08:00
Diffstat (limited to 'wk1/lab1/population.c')
-rw-r--r--wk1/lab1/population.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/wk1/lab1/population.c b/wk1/lab1/population.c
index c95d844..0e9c32d 100644
--- a/wk1/lab1/population.c
+++ b/wk1/lab1/population.c
@@ -3,6 +3,15 @@
int main(void)
{
- int start = get_int("Starting number of llamas: ");
- int end = get_int("Ending number of ");
+ int n = get_int("Start size: ");
+ int end = get_int("End size: ");
+ int year = 0;
+ while (n < end)
+ {
+ n += n/3;
+ n -= n/4;
+ year++;
+ printf("%i", year);
+ }
+ printf("Years: %i", year);
}