Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Name this program change.c – You have an amount of change (such as 41 cents or 7

ID: 3665473 • Letter: N

Question

Name this program change.c – You have an amount of change (such as 41 cents or 72 cents) and you want to figure out how many quarters, dimes, nickels and pennies that is. Your change will always be an integer value between 0 and 99. You can do this with integer division and the mod operator (%). For example, consider 72 cents. The process defined below will figure out the correct combination of coins: • Divide 72 by 25 using integer division to determine the number of quarters (72 / 25 = 2) then use the mod function 72 % 25 to see how much change is left (72 % 25 = 22) • Take the 22 (what you have left) and figure out how many dimes that is (22 / 10 = 2) then use the mod function to see how much change is left (22 % 10 = 2) • Take the 2 (what you have left) and figure out how many nickels that is (2 / 5 = 0) then use the mod function to see how much change is left (2 % 5 = 2) • Take the 2 (what you have left) and that is your pennies • Print the number of quarters (2), dimes (2), nickels (0) and pennies (2)

Explanation / Answer

#include<stdio.h>

void main()
{
int change,left;
int quarter,dimes,nickels,pennies;
printf("enter the amount of change ");
scanf("%d",&change);//read change value
quarter=change/25;//finding how many quarter it contains
left=change%25;
change=left;//update the change
dimes=change/10;//finding how many dimes it contains
left=change%10;
change=left;
nickels=change/5;//finding how many nickels
left=change%5;
change=left;
pennies=left;//finding how many pennies
printf("quarter is %d,dimes is %d, nickels is %d,pennies is %d",quarter,dimes,nickels,pennies);
}

if you have any doubt than comment it below and please don't forget to give feedback

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote