Last active
March 12, 2021 21:28
-
-
Save M0rais/e5943ae361dc96e73d798bbe8590dd7b to your computer and use it in GitHub Desktop.
Kotlin program to print the FIBONACCI series up to the X term
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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