-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopulation.c
More file actions
39 lines (29 loc) · 739 Bytes
/
population.c
File metadata and controls
39 lines (29 loc) · 739 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int startsize, endsize, years = 0, new_lamas = 0, dead_lamas = 0;
do
{
startsize = get_int("Start size: ");
}
while (startsize < 9);
do
{
endsize = get_int("End size: ");
}
while (endsize < startsize);
while (startsize < endsize)
{
new_lamas = startsize / 3;
dead_lamas = startsize / 4;
startsize = startsize + (new_lamas - dead_lamas);
years++;
// printf("years");
}
printf("Years: %i\n", years);
// TODO: Prompt for start size
// TODO: Prompt for end size
// TODO: Calculate number of years until we reach threshold
// TODO: Print number of years
}