Computers and Technology

Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is:0 or less than 0, the output is:No change Ex: If the input is:45the output is:1 Quarter2 Dimes Fix code please getting error on code#include #include int main(){int coin, dollar, quarter, dime, nickel, penny, rem;scanf("%d\n",&coin);if(coin <=0){printf("No change\n");}else{// calculate Dollersdollar = coin/100;rem = coin%100;if(dollar<=1){printf("% d Dollar\n", dollar);}else{printf("%d Dollars\n", dollar);}// calculate Quartersquarter= rem/25;rem= rem%25;if(quarter<=1){printf("%d Quarter\n", quarter);}else{printf("%d Quarters\n", quarter);}// calculate Dimesdime= rem/10;rem= rem%10;if(quarter<=1){printf("%d Dime\n", dime);}else{printf("%d Dimes\n", dime);}// calculate Nickelsnickel= rem/5;rem= rem%5;if(nickel<=1){printf("%d Nickel\n", nickel);}else{printf("%d Nickels\n", nickel);}// calculate Penniespenny= rem;if(penny<=1){printf("%d Penny\n", penny);}else{printf("d Pennies\n", penny);}return 0}ERROR below: Compare outputkeyboard_arrow_up0 / 2Output differs. See highlights below. Special character legendInput45Your output0 Dollar 1 Quarter 2 Dime 0 Nickel 0 PennyExpected output1 Quarter 2 Dimes2: Compare outputkeyboard_arrow_up2 / 2Input0Your outputNo change3: Compare outputkeyboard_arrow_up0 / 2Output differs. See highlights below. Special character legendInput156Your output1 Dollar 2 Quarters 0 Dimes 1 Nickel 1 PennyExpected output1 Dollar 2 Quarters 1 Nickel 1 Penny4: Compare outputkeyboard_arrow_up0 / 2Output differs. See highlights below. Special character legendInput300Your output3 Dollars 0 Quarter 0 Dime 0 Nickel 0 PennyExpected output3 Dollars

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:00, fnaflover8505
Businesses allocate resources for their best and most productive uses. the more a resource, the more costly it will be. a manufacturer that requires scarce and costly resources is likely to charge for its products.
Answers: 2
image
Computers and Technology, 22.06.2019 14:10, normarismendoza
Dean wants a quick way to look up staff members by their staff id. in cell q3, nest the existing vlookup function in an iferror function. if the vlookup function returns an error result, the text “invalid staff id” should be displayed by the formula. (hint: you can test that this formula is working by changing the value in cell q2 to 0, but remember to set the value of cell q2 back to 1036 when the testing is complete.)
Answers: 3
image
Computers and Technology, 23.06.2019 09:30, caromaybelline71
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
image
Computers and Technology, 23.06.2019 18:50, annieleblanc2004
Ais a picture icon that is a direct link to a file or folder
Answers: 1
Do you know the correct answer?
Write a program with total change amount as an integer input, and output the change using the fewest...

Questions in other subjects:

Konu
Mathematics, 27.03.2020 20:30
Konu
Mathematics, 27.03.2020 20:30