Question: In c please! Overview This program will ask for an amount of $20s, $10s, $5s, $1s, quarters, dimes, nickels, and pennies. It will then calculate
In c please! Overview
This program will ask for an amount of $20s, $10s, $5s, $1s, quarters, dimes, nickels, and pennies. It will then calculate the total amount of money in dollars and cents as well as the length of the bills and coins.
Example
Enter the number of $20s: 3 Enter the number of $10s: 1 Enter the number of $5s: 4 Enter the number of $1s: 15 Enter the number of quarters: 9 Enter the number of dimes: 26 Enter the number of nickels: 53 Enter the number of pennies: 58 You have 113 dollars and 8 cents The length of your money is roughly 256 inches
Details
- All bills are 6.14in long.
- Quarters have a 0.955in diameter.
- Dimes have a 0.705in diameter.
- Nickels have a 0.835in diameter.
- Pennies have a 0.750in diameter.
- Be sure to match the output in the example exactly. Input and output order matter. You do not need to worry about handling plural vs. singular forms of the words in the output. For example, outputting 1 inches is acceptable and expected. Use the round() function when outputting the length.
- Assume valid input.
- Do not use the type float; use double.
- Whenever trying to convert a real number into an integer, use the round function in math.h to convert. For example, to convert 2.51, use (int)round(2.51) which results in 3. This may be helpful when calculating dollars and cents.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
