title: Is it possible to add two numbers whose power is the iterator in for loop in Kotlin without using power function
body: <p><strong>Programming Language: KOTLIN</strong></p>
  <p>I'm trying to make a function which adds two numbers in the following way..
  <strong>a^i+b^i</strong> where &quot;i&quot; would be the iterator in for loop. So I want the i to range from 1 to 10 and print the result one by one like this... for example if I give the values as a=1 &amp; b=2 then the result must be calculated as..
  a^1+b^1= 1^1+2^1 which gives 3 so print the result.
  a^2+b^2= 1^2+2^2 which gives 6 and print the result.
  etc., repeating the process until &quot;i&quot; becomes 10.
  so I tried the following code and it only prints the result of initial values.</p>
  <pre><code>fun main(){
      println(test(22,33))
  }
  fun test(a:Int,b:Int):Int{
      var result1=1
      var result2=1
      var result3=result1+result2
       for(i in 1..10){
           result1*=a
           result2*=b
           result3=a+b
           println(result3)
           }
       return result3
     }
  </code></pre>