forked from root/public
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
384 B
31 lines
384 B
package main |
|
|
|
import ( |
|
student "student" |
|
|
|
"lib" |
|
) |
|
|
|
func fibonacci(i int) int { |
|
if i < 0 { |
|
return -1 |
|
} |
|
if i == 0 { |
|
return 0 |
|
} |
|
if i == 1 { |
|
return 1 |
|
} |
|
return fibonacci(i-1) + fibonacci(i-2) |
|
} |
|
|
|
func main() { |
|
table := append(lib.MultRandIntBetween(0, 25), |
|
4, |
|
5, |
|
-5, |
|
) |
|
for _, arg := range table { |
|
lib.Challenge("Fibonacci", student.Fibonacci, fibonacci, arg) |
|
} |
|
}
|
|
|