• anonymous
For the first problem set, I would like to round the remaining balances to the nearest penny. The function round(balance, 2) doesn't seem to do anything....what's the right way to do this?
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • katieb
I got my questions answered at in under 10 minutes. Go to now for free help!
  • anonymous
to be clearer, if for example the result is $16.00 dollars, for example, I will get the output $16.0 dollars
  • rsmith6559
That's a print formatting issue. In C style syntax the format string would be "$%4.2f" For a 4 digit, 2 to the right of the decimal float number.

Looking for something else?

Not the answer you are looking for? Search for more explanations.