Ask Question
17 August, 05:16

Write a function number_of_pennies () that returns the total number of pennies given a number of dollars and (optionally) a number of pennies. ex: 5 dollars and 6 pennies returns 506.

+2
Answers (1)
  1. 17 August, 08:14
    0
    Ok, first of all, it is important to understand that this function would depend on 2 variables; the number of dollars (x) and the number of pennies (y). Every dollar is equivalent to 100 pennies. So, if we are given x dollars, we have 100*x pennies. If we also have y pennies, we still get y pennies. We need to add these two to get the total amount of pennies. Thus, the correct function is:

    f (x, y) = 100*x+y
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a function number_of_pennies () that returns the total number of pennies given a number of dollars and (optionally) a number of ...” in 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers