A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Fibonacci in Groovy page! Here, you'll find the source code for this program as well as a description of how the program works.
class Fibonacci {
static void main(String[] args) {
if (args.length < 1 || !args[0].isInteger()) {
println 'Usage: please input the count of fibonacci numbers to output'
} else {
def n = args[0] as Integer
if (n > 0) {
def first = 0G
def second = 1G
(1..n).each {
second += first
first = second - first
println "$it: $first"
}
}
}
}
}
Fibonacci in Groovy was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.