enter image description here

I havent finished the whole, just the dollar part. But the formulation cannot be run correctly Can anyone tell me which part is incorrect?

1 Answer 1


Floating point cannot accurately represent values like 4.2. int conversion truncates the value (rounds towards zero), you might want to use round from math.h or something like that.

You might have meant dollar = (change - change % 100) / 100;, which could be just dollar = change / 100; since integer division also truncates.

Also, you probably meant >0 instead of >=0. That whole if is not really required.

You must log in to answer this question.

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