0

This is where my issue is coming from

// TODO: Calculate number of years until we reach threshold int n = start; int years = 0; while (start < end) { n = n + (n / 3) - (n / 4); years++; } // TODO: Print number of years printf("Years: %i/n", years); } 

Something seem to be wrong but I can't figure it out. It compiling all code except the "Years". I'm not getting an answer after the division. Please help

1 Answer 1

0

This looks like an infinite loop to me.

while (start < end) { n = n + (n / 3) - (n / 4); years++; } 

There's nothing in the loop that updates the value of either start or end. If the loop executes once, it'll execute forever.

Also, are you confusing "compile" with "execute"? I don't see anything there that would prevent compiling, but then I have no idea what the rest of the code looks like.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.