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

int main(void)
{
    // TODO: Prompt for start size
    int start;
    do
    {
        start = get_int("start size: ");
    }
    while (start < 9);
    // TODO: Prompt for end size
    int finish;
    {
        finish = get_int("finish size: ");
    }
    while ( finish < start)

    // TODO: Calculate number of years until we reach threshold
    int years = 0;

    // TODO: Print number of years
    while (start < finish)
    {
        start = start + (start/3) - (start/4);
        years++;
    }
    printf("years:%i\n", years);
}

1 Answer 1

0

In the lines

int finish;
{
    finish = get_int("finish size: ");
}
while ( finish < start)

there is a do missing before the { and there is a ; missing at the end of the do...while statement. It should look like this:

int finish;

do
{
    finish = get_int("finish size: ");
}
while ( finish < start);

That is why you are getting the error message.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .