Fibonacci Series in GO

Fibonacci Series in GO Language

Source code :


package main

import "fmt"

func main() {

    limit := 10 // Change the limit here ( n value )
    
    n := 0
    x := -1
    y := 1

    for i := 0; i < limit; i++ {
	
        n = x + y
        x = y
        y = n
        
    fmt.Println(n)

    }
}


Output :

0
1
1
2
3
5
8
13
21
34

Output :


                

Comments :