Mode entretien. Minuteur de 10 min, sans indices ni autocomplétion
Total price of pies
FacileBasics10 min
Write a function piesPrice(dollars, cents, count) that finds how much count pies cost. One pie costs dollars dollars and cents cents. 1 dollar is 100 cents.
- All three parameters are integers:
dollarsandcountare 0 or more,centsis from 0 to 99. - Return an array of two integers:
[totalDollars, totalCents]. totalCentsis from 0 to 99: every 100 cents make one more dollar. 3 pies at 2 dollars 50 cents cost 7 dollars 50 cents, so the answer is[7, 50], not[6, 150].- If
countis 0, the pies cost nothing: return[0, 0].
Exemples
piesPrice(2, 50, 3)Renvoie [ 7, 50 ]
piesPrice(10, 15, 2)Renvoie [ 20, 30 ]
Posé chez T-Bank · Source
Chargement de l'éditeur...
- Entrée
piesPrice(2, 50, 3)Attendu[ 7, 50 ] - Entrée
piesPrice(10, 15, 2)Attendu[ 20, 30 ] - Entrée
piesPrice(2, 5, 2)Attendu[ 4, 10 ] - Entrée
piesPrice(5, 20, 0)Attendu[ 0, 0 ]
Les tests cachés se lancent à la soumission