From 2edb0b5c21b754263477f5db336e49faf2fe40bd Mon Sep 17 00:00:00 2001 From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> Date: Sun, 3 Dec 2023 06:10:10 +0000 Subject: Sat, Dec 2, 2023, 10:10 PM -08:00 --- wk1/lab1/population.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'wk1/lab1/population.c') 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); } -- cgit v1.2.3