Question: CHALLENGE ACTIVITY 2 . 1 1 . 2 : Integer division and modulo Jump to level 1 Convert totalPennies to dimes, nickels, and pennies, finding

CHALLENGE
ACTIVITY
2.11.2: Integer division and modulo
Jump to level 1
Convert totalPennies to dimes, nickels, and pennies, finding the maximum number of dimes, then nickels, then pennies.
Ex: If the input is 59, then the output is:
Dimes: 5
Nickels: 1
Pennies: 4
Note: A dime is 10 pennies. A nickel is 5 pennies.
int main(){
int totalpennies;
int numDimes;
int numNickels;
int numPennies;
cin totalPennies;
numDimes = totalPennies ?10;
numPennies =
numNickels totalPennies &10;
numPennies = numNickels &5;
cout "Dimes: " numDimes endl;
cout "Nickels: " numNickels endl;
cout "Pennies: " numPennies endl;
 CHALLENGE ACTIVITY 2.11.2: Integer division and modulo Jump to level 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!