title: simple logic for calculating discount price depending on quantity
body: <p>I am working shopping cart with only one product, in which I have to offer 50% discount for every second item ("for every unit bought at full price, you can get another one at half price").</p>
  
  <p>For example, let's say the product price is $10.</p>
  
  <pre><code>if 1 qty Total Price = $10 ($10).
  if 2 qty Total Price = $15 ($10 + $5).
  if 3 qty total price = $25 ($10 + $5 + $10).
  if 4 qty total price = $30 ($10 + $5 + $10 + $5).
  if 5 qty total price = $40 ($10 + $5 + $10 + $5 + $10).
  and so on ...
  </code></pre>
  
  <p>So what would be the logic to find discount depending on quantity of items?</p>