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 11:00, terriblexsiren
You receive an email from an impressive-sounding stranger, professor alexander rothschild renard iii, president of the american institute for scientific political statesmen. he urges you to vote for his presidential candidate choice. this social media red flag is known as
Answers: 1
image
Computers and Technology, 23.06.2019 00:40, QueenKy6050
Consider the following statements: struct nametype{string first; string last; }; struct coursetype{string name; int callnum; int credits; char grade; }; struct studenttype{nametype name; double gpa; coursetype course; }; studenttype student; studenttype classlist[100]; coursetype course; nametype name; mark the following statements as valid or invalid. if a statement is invalid, explain why. a.) student. course. callnum = "csc230"; b.) cin > > student. name; c.) classlist[0] = name; d.) classlist[1].gpa = 3.45; e.) name = classlist[15].name; f.) student. name = name; g.) cout < < classlist[10] < < endl; h.) for (int j = 0; j < 100; j++)classlist[j].name = name; i.) classlist. course. credits = 3; j.) course = studenttype. course;
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, alannaamarriee
Jace needs to answer a question on square roots to win a quiz. how can he use a spreadsheet to find the square root of 786? a. use the functions round and count b. create a table and chart c. use the function sqrt d. use the function now
Answers: 3
image
Computers and Technology, 23.06.2019 15:30, Dweath50
The processing of data in a computer involves the interplay between its various hardware components.
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: