title: How to convert a number to a range of prices
body: <p>I want to calculate the amount to charge my customers, when they buy licenses of my product.</p>
  
  <p>I sell it in ranges of licenses:</p>
  
  <ul>
  <li>1-10 : $50/user</li>
  <li>11-20 : $40/user</li>
  <li>21-30 : $30/user</li>
  <li>31-50 : $20/user</li>
  </ul>
  
  <p>So when someone purchases 136 licenses, I will charge him:</p>
  
  <pre><code>50 x 2 x $20 = $2000
  30 x 1 x $30 = $900
       6 x $50 = $300
  </code></pre>
  
  <p>I'm looking for an algorithm on how to process the given number and break it into number of occurrences in a range..
  How can I do this in plain C# or LINQ?</p>
  
  <p>------------ EDIT ----------------------------</p>
  
  <p>I started a less confusing question (<a href="https://stackoverflow.com/questions/2685391/algorithm-for-fogbugz-pricing-scheme">Algorithm for Fogbugz pricing scheme</a>) and I got the answer I've been looking for.</p>
  
  <p>Thank you all..</p>