I'm doing cs50 code about calculating the population of llamas but it stops in the middle and does not return any thing. the code asks the user to enter number of start size and end size then calculate how many years it needs to reach the end size
note 1: the code uses <cs50.h> header.
#include <cs50.h>
#include <stdio.h>
int main(void)
{
// TODO: Prompt for start size
int start_size;
do
{
start_size = get_int("enter the start size\n");
}
while (start_size < 9);
// TODO: Prompt for end size
int end_size;
do
{
end_size = get_int("enter the end size\n");
}
while (end_size < start_size);
// TODO: Calculate number of years until we reach threshold
int years = 0;
do
{
start_size = start_size + (start_size/3);
start_size = start_size - (start_size/4);
years++;
}
while (start_size < end_size);
// TODO: Print number of years
printf("the needed number of years is: %i\n",years);
}
note 2: I tried to execute the code in online IDE after replacing the get_int
with scanf
and still not work