Write a complete C program that makes change for amounts less than one dollar. That is, you will determine the number of coins that can make up a specific number of cents. Valid input to the program should be a positive integer value less than 100, which represents an amount of money, in cents. The program should prompt the user for a positive integer value, and in response to user input, should print the original amount of cash, together with a set of coins (quarters, dimes, nickels, cents) that make up that amount. The program should produce change containing the minimum number of coins required for the given amount. The output should be in a natural form, in that whenever there is one coin, the coin type should be singular, otherwise, the coin type should be in its plural form. If the number of coins for a particular coin type is 0, the type should not be shown. For example, if user input is 58 cents, the output must look like this: 58 cents: 2 quarters, 1 nickel, 3 cents. The following shows an example of an incorrect output: 58 cents: 2 quarters, 0 dimes, 1 nickels, 3 cents. The program should repeatedly prompt the user for additional user input, until an invalid input is entered, after which the program should stop. An invalid input would be a negative number, one that is greater than 99, or less than 1. It can be assumed that the user always enters integer values when prompted. An example run of the program is shown below. The values 10, 16, 20, . . . are entered by the user in the example run. Given the same user input, your output should match the following output exactly, including all punctuation, and all wording (including the plural form if needed).
-
Notifications
You must be signed in to change notification settings - Fork 0
Write a complete C program that makes change for amounts less than one dollar. That is, you will determine the number of coins that can make up a specific number of cents. Valid input to the program should be a positive integer value less than 100, which represents an amount of money, in cents. The program should prompt the user for a positive i…
Hasteerp/Change2.0
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Write a complete C program that makes change for amounts less than one dollar. That is, you will determine the number of coins that can make up a specific number of cents. Valid input to the program should be a positive integer value less than 100, which represents an amount of money, in cents. The program should prompt the user for a positive i…
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published