- #1
ineedhelpnow
- 651
- 0
A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields 3 fives and 4 ones. Write a single statement that assigns the number of distributed 1 dollar bills to variable numOnes, given amountToChange. Hint: Use %.
Sample program:
#include <iostream>
using namespace std;
int main() {
int amountToChange = 0;
int numFives = 0;
int numOnes = 0;
amountToChange = 19;
numFives = amountToChange / 5;
<STUDENT CODE>
return 0;
}
i only have to write code for the part that says <student code>. i tried numOnes = 19 % 5;
its wrong though. it passed two tests but failed one.
Sample program:
#include <iostream>
using namespace std;
int main() {
int amountToChange = 0;
int numFives = 0;
int numOnes = 0;
amountToChange = 19;
numFives = amountToChange / 5;
<STUDENT CODE>
return 0;
}
i only have to write code for the part that says <student code>. i tried numOnes = 19 % 5;
its wrong though. it passed two tests but failed one.
Last edited: