title: Adding values together
body: <p>I finally got my previous question regarding &quot;if else statements&quot; but I cannot get the last line of code in the Javascript to add the numbers together, I keep getting NaN as the result, which I now know is Not a Number.</p>
  <p>If anyone could point me in the right direction to add the 9 values up it would be appreciated.</p>
  <p>HTML</p>
  <pre class="lang-html prettyprint-override"><code>&lt;p id=&quot;payout-text&quot;&gt;     
    &lt;b&gt; To calculate Prize distribution each Player will receive:&lt;/b&gt;
    &amp;ensp; Enter the Prize Pool.             
    &lt;br&gt;
    &lt;span id=&quot;prizepool-input&quot;&gt; &amp;emsp; &lt;input type=&quot;text&quot; id=&quot;prizepool&quot; /&gt; &lt;/span&gt;
    &lt;br&gt;
    &amp;emsp;  Enter number of Players.
    &lt;br&gt;
    &lt;span id=&quot;players-input&quot;&gt; &amp;emsp; &lt;input type=&quot;text&quot; id=&quot;players&quot; oninput=&quot;multiplyBy()&quot; Value=&quot;&quot;/&gt; &lt;/span&gt; 
    &lt;br&gt;
    &lt;br&gt;  &amp;emsp;  1st Place: &lt;span id = &quot;payout-first&quot;&gt;&lt;/span&gt;
    &lt;br&gt;  &amp;emsp; 2nd Place: &lt;span id = &quot;payout-second&quot;&gt;&lt;/span&gt; 
    &lt;br&gt;  &amp;emsp; 3rd Place: &lt;span id = &quot;payout-third&quot;&gt;&lt;/span&gt;
    &lt;br&gt;  &amp;emsp; 4th Place: &lt;span id = &quot;payout-fourth&quot;&gt;&lt;/span&gt;
    &lt;br&gt;  &amp;emsp; 5th Place: &lt;span id = &quot;payout-fifth&quot;&gt;&lt;/span&gt;
    &lt;br&gt;  &amp;emsp; 6th Place: &lt;span id = &quot;payout-sixth&quot;&gt;&lt;/span&gt;
    &lt;br&gt;  &amp;emsp; 7th Place: &lt;span id = &quot;payout-seventh&quot;&gt;&lt;/span&gt;
    &lt;br&gt;  &amp;emsp; 8th Place: &lt;span id = &quot;payout-eighth&quot;&gt;&lt;/span&gt;
    &lt;br&gt;  &amp;emsp; 9th Place: &lt;span id = &quot;payout-ninth&quot;&gt;&lt;/span&gt;
    &lt;br&gt;
    &lt;br&gt;&amp;emsp; &amp;emsp;  &amp;emsp; Total: &lt;span id = &quot;payout-all&quot;&gt;&lt;/span&gt; 
  &lt;/p&gt;
  </code></pre>
  <p>Javascript</p>
  <pre><code>&lt;script&gt;
  function multiplyBy() {
    num1 = document.getElementById(&quot;prizepool&quot;).value;
    num2 = document.getElementById(&quot;players&quot;).value;
  
    prize1 = document.getElementById(&quot;payout-first&quot;).value;
    prize2 = document.getElementById(&quot;payout-second&quot;).value;
    prize3 = document.getElementById(&quot;payout-third&quot;).value;
    prize4 = document.getElementById(&quot;payout-fourth&quot;).value;
    prize5 = document.getElementById(&quot;payout-fifth&quot;).value;
    prize6 = document.getElementById(&quot;payout-sixth&quot;).value;
    prize7 = document.getElementById(&quot;payout-seventh&quot;).value;
    prize8 = document.getElementById(&quot;payout-eighth&quot;).value;
    prize9 = document.getElementById(&quot;payout-ninth&quot;).value;
    
    if (num2 &lt;= 4) { 
      document.getElementById(&quot;payout-first&quot;).innerHTML = Math.ceil ((num1 * 100)/100) .toLocaleString();
    }
    else if (num2 &lt;= 14) { 
      document.getElementById(&quot;payout-first&quot;).innerHTML = Math.ceil ((num1 * 65)/100) .toLocaleString();
    }
    else if (num2 &lt;= 24) { 
      document.getElementById(&quot;payout-first&quot;).innerHTML = Math.ceil ((num1 * 50)/100) .toLocaleString();
    }
    else if (num2 &lt;= 34) { 
      document.getElementById(&quot;payout-first&quot;).innerHTML = Math.ceil ((num1 * 45)/100) .toLocaleString();
    }
    else if (num2 &lt;= 44) { 
      document.getElementById(&quot;payout-first&quot;).innerHTML = Math.ceil ((num1 * 40)/100) .toLocaleString();
    }
    else if (num2 &lt;= 54) { 
      document.getElementById(&quot;payout-first&quot;).innerHTML = Math.ceil ((num1 * 36)/100) .toLocaleString();
    }
    else if (num2 &lt;= 64) { 
      document.getElementById(&quot;payout-first&quot;).innerHTML = Math.ceil ((num1 * 35)/100) .toLocaleString();
    }
    else if (num2 &lt;= 74) { 
      document.getElementById(&quot;payout-first&quot;).innerHTML = Math.ceil ((num1 * 34)/100) .toLocaleString();
    }
    else if (num2 &lt;= 84) { 
      document.getElementById(&quot;payout-first&quot;).innerHTML = Math.ceil ((num1 * 32)/100) .toLocaleString();
    }
                          
    if (num2 &lt;= 4) { 
      document.getElementById(&quot;payout-second&quot;).innerHTML = Math.ceil (num1 * 0) .toLocaleString();
    }
    else if (num2 &lt;= 14) { 
      document.getElementById(&quot;payout-second&quot;).innerHTML = Math.ceil ((num1 * 35)/100) .toLocaleString();
    }
    else if (num2 &lt;= 24) { 
      document.getElementById(&quot;payout-second&quot;).innerHTML = Math.ceil ((num1 * 30)/100) .toLocaleString();
    }
    else if (num2 &lt;= 34) {
      document.getElementById(&quot;payout-second&quot;).innerHTML = Math.ceil ((num1 * 28)/100) .toLocaleString();
    }
    else if (num2 &lt;= 44) { 
      document.getElementById(&quot;payout-second&quot;).innerHTML = Math.ceil ((num1 * 24)/100) .toLocaleString(); 
    }
    else if (num2 &lt;= 54) { 
      document.getElementById(&quot;payout-second&quot;).innerHTML = Math.ceil ((num1 * 23)/100) .toLocaleString();
    }
    else if (num2 &lt;= 64) {
      document.getElementById(&quot;payout-second&quot;).innerHTML = Math.ceil ((num1 * 22)/100) .toLocaleString();
    }
    else if (num2 &lt;= 74) { 
      document.getElementById(&quot;payout-second&quot;).innerHTML = Math.ceil ((num1 * 21)/100) .toLocaleString();
    }
    else if (num2 &lt;= 84) { 
      document.getElementById(&quot;payout-second&quot;).innerHTML = Math.ceil ((num1 * 20)/100) .toLocaleString();
    }
    
    if (num2 &lt;= 14) { 
      document.getElementById(&quot;payout-third&quot;).innerHTML = Math.ceil (0) .toLocaleString();
    }
    else if (num2 &lt;= 24) { 
      document.getElementById(&quot;payout-third&quot;).innerHTML = Math.ceil ((num1 * 20)/100) .toLocaleString();
    }
    else if (num2 &lt;= 34) { 
      document.getElementById(&quot;payout-third&quot;).innerHTML = Math.ceil ((num1 * 17)/100) .toLocaleString();
    }
    else if (num2 &lt;= 44) { 
      document.getElementById(&quot;payout-third&quot;).innerHTML = Math.ceil ((num1 * 16)/100) .toLocaleString();
    }
    else if (num2 &lt;= 54) { 
      document.getElementById(&quot;payout-third&quot;).innerHTML = Math.ceil ((num1 * 15)/100) .toLocaleString();
    }
    else if (num2 &lt;= 64) { 
      document.getElementById(&quot;payout-third&quot;).innerHTML = Math.ceil ((num1 * 14)/100) .toLocaleString();
    }
    else if (num2 &lt;= 74) { 
      document.getElementById(&quot;payout-third&quot;).innerHTML = Math.ceil ((num1 * 13)/100) .toLocaleString();
    }
    else if (num2 &lt;= 84) { 
      document.getElementById(&quot;payout-third&quot;).innerHTML = Math.ceil ((num1 * 11)/100) .toLocaleString();
    }
  
    if (num2 &lt;= 24) { 
      document.getElementById(&quot;payout-fourth&quot;).innerHTML = Math.ceil (0) .toLocaleString();
    }
    else if (num2 &lt;= 34) { 
      document.getElementById(&quot;payout-fourth&quot;).innerHTML = Math.ceil ((num1 * 10)/100) .toLocaleString();
    }
    else if (num2 &lt;= 44) { 
      document.getElementById(&quot;payout-fourth&quot;).innerHTML = Math.ceil ((num1 * 12)/100) .toLocaleString();
    }
    else if (num2 &lt;= 54) { 
      document.getElementById(&quot;payout-fourth&quot;).innerHTML = Math.ceil ((num1 * 11)/100) .toLocaleString();
    }
    else if (num2 &lt;= 64) { 
      document.getElementById(&quot;payout-fourth&quot;).innerHTML = Math.ceil ((num1 * 10)/100) .toLocaleString();
    }
    else if (num2 &lt;= 74) { 
      document.getElementById(&quot;payout-fourth&quot;).innerHTML = Math.ceil ((num1 * 9)/100) .toLocaleString();
    }
    else if (num2 &lt;= 84) { 
      document.getElementById(&quot;payout-fourth&quot;).innerHTML = Math.ceil ((num1 * 9)/100) .toLocaleString();
    }
  
    if (num2 &lt;= 34) {
      document.getElementById(&quot;payout-fifth&quot;).innerHTML = Math.ceil (0) .toLocaleString();
    }
    else if (num2 &lt;= 44) { 
      document.getElementById(&quot;payout-fifth&quot;).innerHTML = Math.ceil ((num1 * 8)/100) .toLocaleString();
    }
    else if (num2 &lt;= 54) { 
      document.getElementById(&quot;payout-fifth&quot;).innerHTML = Math.ceil ((num1 * 8)/100) .toLocaleString();
    }
    else if (num2 &lt;= 64) { 
      document.getElementById(&quot;payout-fifth&quot;).innerHTML = Math.ceil ((num1 * 8)/100) .toLocaleString();
    }
    else if (num2 &lt;= 74) { 
      document.getElementById(&quot;payout-fifth&quot;).innerHTML = Math.ceil ((num1 * 7)/100) .toLocaleString();
    }
    else if (num2 &lt;= 84) { 
      document.getElementById(&quot;payout-fifth&quot;).innerHTML = Math.ceil ((num1 * 7)/100) .toLocaleString();
    }
  
    if (num2 &lt;= 44) { 
      document.getElementById(&quot;payout-sixth&quot;).innerHTML = Math.ceil (0) .toLocaleString();
    }
    else if (num2 &lt;= 54) { 
      document.getElementById(&quot;payout-sixth&quot;).innerHTML = Math.ceil ((num1 * 7)/100) .toLocaleString();
    }
    else if (num2 &lt;= 64) { 
      document.getElementById(&quot;payout-sixth&quot;).innerHTML = Math.ceil ((num1 * 6)/100) .toLocaleString();
    }
    else if (num2 &lt;= 74) { 
      document.getElementById(&quot;payout-sixth&quot;).innerHTML = Math.ceil ((num1 * 6)/100) .toLocaleString();
    }
    else if (num2 &lt;= 84) { 
      document.getElementById(&quot;payout-sixth&quot;).innerHTML = Math.ceil ((num1 * 6)/100) .toLocaleString();
    }
  
    if (num2 &lt;= 54) { 
      document.getElementById(&quot;payout-seventh&quot;).innerHTML = Math.ceil (0) .toLocaleString();
    }
    else if (num2 &lt;= 64) { 
      document.getElementById(&quot;payout-seventh&quot;).innerHTML = Math.ceil ((num1 * 5)/100) .toLocaleString();
    }
    else if (num2 &lt;= 74) { 
      document.getElementById(&quot;payout-seventh&quot;).innerHTML = Math.ceil ((num1 * 5)/100) .toLocaleString();
    }
    else if (num2 &lt;= 84) { 
      document.getElementById(&quot;payout-seventh&quot;).innerHTML = Math.ceil ((num1 * 6)/100) .toLocaleString();
    }
  
    if (num2 &lt;= 64) { 
      document.getElementById(&quot;payout-eighth&quot;).innerHTML = Math.ceil (0) .toLocaleString();
    }
    else if (num2 &lt;= 74) { 
      document.getElementById(&quot;payout-eighth&quot;).innerHTML = Math.ceil ((num1 * 5)/100) .toLocaleString();
    }
    else if (num2 &lt;= 84) { 
      document.getElementById(&quot;payout-eighth&quot;).innerHTML = Math.ceil ((num1 * 5)/100) .toLocaleString();
    }
  
    if (num2 &lt;= 74) { 
      document.getElementById(&quot;payout-ninth&quot;).innerHTML = Math.ceil (0) .toLocaleString();
    }
    else if (num2 &lt;= 84) { 
      document.getElementById(&quot;payout-ninth&quot;).innerHTML = Math.ceil ((num1 * 4)/100) .toLocaleString();
    }
    else { 
      document.getElementById(&quot;payout-ninth&quot;).innerHTML = Math.ceil (0) .toLocaleString();
    }
  
    {document.getElementById(&quot;payout-all&quot;).innerHTML = Math.ceil (prize1 + prize2  + prize3 + prize4 + prize5 + prize6 + prize7 + prize8 + prize9) .toLocaleString();}
  
  }
  &lt;/script&gt;
  </code></pre>