title: Mapping a numeric range onto another
body: <p>Math was never my strong suit in school :(</p>
  
  <pre><code>int input_start = 0;    // The lowest number of the range input.
  int input_end = 254;    // The largest number of the range input.
  int output_start = 500; // The lowest number of the range output.
  int output_end = 5500;  // The largest number of the range output.
  
  int input = 127; // Input value.
  int output = 0;
  </code></pre>
  
  <p>How can I convert the input value to the corresponding output value of that range?</p>
  
  <p>For example, an input value of "0" would equal an output value of "500", an input value of "254" would equal an output value of "5500". I can't figure out how to calculate an output value if an input value is say 50 or 101.</p>
  
  <p>I'm sure it's simple, I can't think right now :)</p>
  
  <p>Edit: I just need whole numbers, no fractions or anything.</p>