0

I'm very new to coding and am really struggling with pset1- cash. I watched some tutorials and walkthrough videos, and with my limited knowledge, I cannot find any issue in the code I made. With the attached code, no matter what positive integer I input, it just multiplies the given number by 4. So if I enter 5, it spits back out 20. I have tried many different things that weren't from videos including if statements and variations of do while. If anyone could help me out, I'd be very grateful!! :)

[EDIT: Code removed for Harvard Honor Code compliance.]

1

Is it possible that you're misinterpreting the correct results? For example, if you input 5, that represents $5.00. That would be 20 quarters and no other coins.

If you only enter a whole number, the result will always, correctly, be 4x that number because there are 4 quarters per dollar. Now, if you entered 0.41, you'd get 4 - a quarter, a dime, a nickel and a penny. ;-)

I ran your code and it works fine.

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

| improve this answer | |
  • Oh my goodness, I guess it really was just a beginners mistake, thank you for clearing it up! – Emily Rose Sep 3 at 4:21

You must log in to answer this question.

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