Problem 45758. Mo money, mo math 1! (★★★)
(adapted from Prob 9 Cody team)
You have a vector where the elements represent the number of $20 bills, $10 bills, $5 bills, $1 bills, quarters, dimes, nickels, and pennies that person has (in that order). Thus, there are 8 elements. What is the total amount of money?
Note for those unfamiliar with American coins: quarter = $0.25, dime = $0.10, nickel = $0.05, penny = $0.01.
Example:
Input x = [1 0 0 0 0 3 0 0] Output y = 20.30
since the wallet has one $20 bill and three dimes.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers77
Suggested Problems
-
Replace NaNs with the number that appears to its left in the row.
2957 Solvers
-
How to find the position of an element in a vector without using the find function
2706 Solvers
-
Remove the two elements next to NaN value
645 Solvers
-
595 Solvers
-
200 Solvers
More from this Author52
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!