Skip to content

Instantly share code, notes, and snippets.

@M0rais
Last active March 12, 2021 21:28
Show Gist options
  • Select an option

  • Save M0rais/e5943ae361dc96e73d798bbe8590dd7b to your computer and use it in GitHub Desktop.

Select an option

Save M0rais/e5943ae361dc96e73d798bbe8590dd7b to your computer and use it in GitHub Desktop.
Kotlin program to print the FIBONACCI series up to the X term
fun main() {
printFibonacci(1000)
}
fun printFibonacci(times: Int) {
var num1 = 1.0
var num2 = 0.0
for (i in 1..times) {
num1 += num2
num2 = num1 - num2
println("Debug nº$i = $num1")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment