Ask Question
12 November, 00:29

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.

+1
Answers (1)
  1. 12 November, 00:48
    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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers