title: how to reduce value in loop
body: <p>I want to make simple program to count debt installment for 5 years installment.
  The requirements is :</p>
  <ol>
  <li>The 1st and 2nd Year the bank interest is 8%</li>
  <li>The 3rd year of bank interest is 9%</li>
  <li>The 4th and 5th year the bank interest is 10%</li>
  </ol>
  <p>and the output should be :</p>
  <ol>
  <li>The value of 1st and 2nd installment</li>
  <li>remaining debt before 3rd year</li>
  <li>the value of 3rd installment</li>
  <li>remaining debt before 4th year</li>
  <li>the value of 4th and 5th installment</li>
  </ol>
  <p>and here's my code :</p>
  <pre><code>package main
  import &quot;fmt&quot;
  
  func main() {
      var debt = 200000000
      var installment int
  
      for i := 1; i &lt;= 5; i++ {
          var remainDebt int
          if i &lt; 3 {
              installment = (debt / 5) + (debt * 8 / 100)
              remainDebt = debt - installment
              fmt.Println(&quot;Year&quot;, i, &quot;is&quot;, installment)
              fmt.Println(&quot;Remaining debt is&quot;, remainDebt)
          } else if i == 3 {
              installment = (debt / 5) + (debt * 9 / 100)
              remainDebt = debt - installment
              fmt.Println(&quot;Year&quot;, i, &quot;is&quot;, installment)
              fmt.Println(&quot;Remaining debt is&quot;, remainDebt)
  
          } else if i &gt; 3 {
              installment = (debt / 5) + (debt * 10 / 100)
              fmt.Println(&quot;Year&quot;, i, &quot;is&quot;, installment)
  
          }
  
      }
  }
  </code></pre>
  <p>And the output from my code is :</p>
  <pre><code>Year 1 is 56000000
  Remaining debt is 144000000
  Year 2 is 56000000
  Remaining debt is 144000000
  Year 3 is 58000000
  Remaining debt is 142000000
  Year 4 is 60000000
  Year 5 is 60000000
  </code></pre>
  <p>I don't know why the remaining debt from each year are wrong. So, I guess that either I am using wrong syntax or I am trying to do something that can not be done. Maybe most likely experienced people will see right away what is wrong.</p>