I've made a program that accepts cent input between 5 and 100, and returns change in quarters/dimes/nickels. When I input 85, it should give back 3 quarters and a dime.
Only the if statement executes. I thought I properly nested my if/else loops but it doesn't seem like it. Can someone tell me how to re-format this code?
You have a logic problem here. Program just does not do what you want.
What you have now: your if statement executes only if amount is evenly divisible by 25, so you can only enter 0, 25, 50, 75 100 etc.
Then you are dividing your amount by 25 losing all modulo information about it
In fact you do not even need any if statements here.
Still wrong logic: you will only give quarter if whole sum can be given as quarters. You do not need conditions there, make one just before calculating change to check if amount is valid.
sorry about that. you were right, I didn't need all of those conditions.
i used the code you supplied without all of those conditions and it worked! I guess when I looked over your code I was confused and didn't understand it fully.