Debug program

Report a typo

Your friend Paul also tries to write a program, which calculates the first 10 Fibonacci numbers. But his program doesn't work. Help Paul write the program.

Pay attention you shouldn't output the 0 value

Sample Input 1:

Sample Output 1:

1
1
2
3
5
8
13
21
34
55
Write a program in Go
package main

import (
"fmt"
)

func main() {
var prev, current = 0, 1
for i := 0; i < 10; i++ {
prev = current
current = fibonacci(prev, current)
fmt.Println(current)
}
}

func fibonacci(prev, current int) int {
return prev + current
}
___

Create a free account to access the full topic