I have written the following code to print the first 10 numbers in a Fibonacci sequence. I am expecting an output of 0,1,1,2,3,5,8,13,21,34. Instead I get 0,1,2,3,5,8,13,21,34,55. Here is the code -
var a = 0
var b = 0
var i = 0
while(i < 10) {
val c = a +b
a = b
b = c
i = i + 1
if (a < 1) a = 1
println(b)
}