Hi! keep getting this error in my code
Could someone kindly help me figuring out whats wrong?
Thank you :)
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
It's a simple problem and the same issue in all cases.
The code is trying to do
dollar % 25 BUT, dollar is a float, not an int. The modulo operator requires both operands to be integers. Modulo cannot be applied to a float.
Maybe you meant to use
owed instead? You'll need to declare owed before the do/while loop for it to stay in scope though.
If this works (looks like it does, I haven't tested), kudos to you. This looks like one of the most creative versions I've seen! Nicely done! [Edit] But after looking more closely, not quite the most efficient. You'll learn more about that in later lessons. ;-)
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)