Population Lab Solution

#include <cs50.h>
#include <stdio.h>
#include <math.h>

// function prototype
int popUpdate(int n);

int main(void)
{
    // TODO: Prompt for start size

    // init some start_size var
    int start_size;
    // do while loop
    do
    {
        // ask user to input the start size
        // collect the start size
        start_size = get_int("Start Size: ");
    }
    // compare start size to 9
    while (start_size < 9);

    // TODO: Prompt for end size
    int end_size;
    do
    {
        end_size = get_int("End Size: ");
    }
    while (end_size < start_size);

    // I know that start_size and end_size are defined by this point in my code

    // TODO: Calculate number of years until we reach threshold
    int num_years = 0;
    while (start_size < end_size)
    {
        start_size = popUpdate(start_size);
        num_years++;
    }

    // TODO: Print number of years
    printf("number of years to reach %i is: %i\n", end_size, num_years);
}

// function definition
int popUpdate(int n)
{
    return n + n / 3 - n / 4; // pop after each year
}