0

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

int main(void) { int counter = 0; int popinc; int e; // TODO: Prompt for start size

    int s;
    do
    {
        s = get_int("Start pop: ");
    }
    while (s < 9);

// TODO: Prompt for end size
    
    do
    {
        e = get_int("End pop: ");
    }
    while (e < s);

// TODO: Calculate number of years until we reach threshold
  
    int years = 0;
    int np;
    
    do
    {
        years++;
        int g;
        int i;
        i = s / 3 - s / 4;
        g = i * years;
        np = g + s;
    }
    while (np < e);
    
    printf ("years to reach threshold %i\n", years);
    

You must log in to answer this question.

Browse other questions tagged .