Ask Question
28 September, 17:58

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.

+4
Answers (1)
  1. 28 September, 19:18
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers