38 lines
584 B
C
38 lines
584 B
C
#include <cs50.h>
|
|
#include <stdio.h>
|
|
|
|
int main()
|
|
{
|
|
// TODO: Prompt for start size
|
|
int start;
|
|
do
|
|
{
|
|
start = get_int("Start size over 9: ");
|
|
}
|
|
while (start < 9);
|
|
|
|
|
|
|
|
// TODO: Prompt for end size
|
|
int end;
|
|
do
|
|
{
|
|
end = get_int("End size: ");
|
|
}
|
|
while (end < start);
|
|
|
|
// TODO: Calculate number of years until we reach threshold
|
|
int years = 0;
|
|
|
|
while (start < end)
|
|
{
|
|
start = start + (start / 3) - (start / 4);
|
|
years++;
|
|
}
|
|
|
|
// TODO: Print number of years
|
|
printf("Years: %i\n", years);
|
|
|
|
|
|
|
|
} |