SHARE
TWEET

Untitled

a guest Nov 19th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def howManyGames(p, d, m, s)
  2.    
  3.     price = p
  4.     discount = d
  5.     money = s
  6.     games = 0
  7.     while money >= price
  8.         money = money - price # paid one game
  9.         games = games + 1 # got one game
  10.         price = price - discount # price is reduced by promotion
  11.         price = price > m ? price : m # until it reaches a bottom limit        
  12.     end
  13.  
  14.     return games
  15. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top