I have been trying to fix this code for the last day, and still can't work out where I am going wrong. Can anyone point me in the right direction please? Thanks in advance!

int main(void)
// Variables 
float f;
int n;
int counter;
        f = get_float("Change: ");
    while (f < 0);
// Convert float to int
n = round(f * 100);
// Count coins
counter = 0;
// Number of coins  
    while (n >= 25)

2 Answers 2


Most important question: did you resave the corrected code and remake it before checking it? The IDE does NOT automatically recompile your code.

I don't think it's an issue with the code above. I think it's an issue either with not saving it, not remaking/recompiling it, or you're editing one version and running another version in another directory.

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

  • Hi Cliff - I always remake it, and don't have another code saved; hence it's led me to believe something is wrong with my code :( Feb 21, 2019 at 14:41
  • I am currently getting results like this: Change: 44 Coins: 176 Feb 21, 2019 at 14:49
  • Just to elaborate a bit more on this answer...If you changing the code and getting the same results you need to save and recompile before running it again. If you don't recompile, you are running the last version and no code updates are included.
    – MrNiceGuy
    Feb 21, 2019 at 19:28

Ok, looks like my code was right, but I was getting confused between dollars and pennies. :/

You must log in to answer this question.

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