Project description The problem here is to make change using the smallest number of American coins. We will ignore dollar and half dollar coins as they are uncommon. Given an amount A (in cents, denoted by the symbol ¢), the solution is to use the maximum number of quarters that do not exceed A in value, then the maximum number of dimes that do not exceed the remaining amount, and likewise for nickels and pennies. For example, for 94¢, 1. we would start with 3 quarters (not 94/25 = 3.76 quarters), leaving 19¢, 2. then 1 dime, leaving 9¢, 3. then 1 nickel, leaving 4¢, 4. and finally 4 pennies. What to do Create your C code in a file named change.c with the prototype int +change (int amount); The input amount is the amount in cents for which we are to make change. 1. Your function should compute the change using a for loop. 2. It should use malloc () to allocate an array of 4 int and return this array containing the number of each coin in the change, in the order quarters, dimes, nickels, and pennies. 3. If the input is negative you should return the NULL pointer. Submit your file change.c and a corresponding Linux object file change.o to the auto- grader on Gradescope for grading. An object file built on a Mac or a Windows system will not work in a Linux environment such as Gradescope.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 20PE: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making...
icon
Related questions
Question
Provide me complete and correct solution thanks 1
Project description
The problem here is to make change using the smallest number of American coins. We will
ignore dollar and half dollar coins as they are uncommon. Given an amount A (in cents,
denoted by the symbol ¢), the solution is to use the maximum number of quarters that do
not exceed A in value, then the maximum number of dimes that do not exceed the remaining
amount, and likewise for nickels and pennies.
For example, for 94¢,
1. we would start with 3 quarters (not 94/25 = 3.76 quarters), leaving 19¢,
2. then 1 dime, leaving 9¢,
3. then 1 nickel, leaving 4¢,
4. and finally 4 pennies.
What to do
Create your C code in a file named change.c with the prototype
int +change (int amount);
The input amount is the amount in cents for which we are to make change.
1. Your function should compute the change using a for loop.
2. It should use malloc () to allocate an array of 4 int and return this array containing
the number of each coin in the change, in the order quarters, dimes, nickels, and
pennies.
3. If the input is negative you should return the NULL pointer.
Submit your file change.c and a corresponding Linux object file change.o to the auto-
grader on Gradescope for grading. An object file built on a Mac or a Windows system will
not work in a Linux environment such as Gradescope.
Transcribed Image Text:Project description The problem here is to make change using the smallest number of American coins. We will ignore dollar and half dollar coins as they are uncommon. Given an amount A (in cents, denoted by the symbol ¢), the solution is to use the maximum number of quarters that do not exceed A in value, then the maximum number of dimes that do not exceed the remaining amount, and likewise for nickels and pennies. For example, for 94¢, 1. we would start with 3 quarters (not 94/25 = 3.76 quarters), leaving 19¢, 2. then 1 dime, leaving 9¢, 3. then 1 nickel, leaving 4¢, 4. and finally 4 pennies. What to do Create your C code in a file named change.c with the prototype int +change (int amount); The input amount is the amount in cents for which we are to make change. 1. Your function should compute the change using a for loop. 2. It should use malloc () to allocate an array of 4 int and return this array containing the number of each coin in the change, in the order quarters, dimes, nickels, and pennies. 3. If the input is negative you should return the NULL pointer. Submit your file change.c and a corresponding Linux object file change.o to the auto- grader on Gradescope for grading. An object file built on a Mac or a Windows system will not work in a Linux environment such as Gradescope.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Hiring Problem
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning