summaryrefslogtreecommitdiff
path: root/wk1/lab1/population.c
blob: 0ae187aca2808abfe26914ea745de1b495d6bee5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include <cs50.h>

int main(void)
{
    float n;
    do
    {
    n = get_int("Start size: ");
    }
    while (n < 9);
    int end;
    do
    {
    end = get_int("End size: ");
    }
    while (end <= n);
    int year = 0;
    while (n < end)
    {
        n += (n/12);
        year++;
    }
    printf("Years: %i\n", year);
}