FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Go/dynamic/fibonacci.go at master · gitgitcode/Go · GitHub
gitgitcode
/
Go
Public
forked from
TheAlgorithms/Go
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Go
/
dynamic
/
fibonacci.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
21 lines (16 loc) · 375 Bytes
Breadcrumbs
Go
/
dynamic
/
fibonacci.go
Copy path
File metadata and controls
21 lines (16 loc) · 375 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package
dynamic
// https://www.geeksforgeeks.org/program-for-nth-fibonacci-number/
// NthFibonacci returns the nth Fibonacci Number
func
NthFibonacci
(
n
uint
)
uint
{
if
n
==
0
{
return
0
}
// n1 and n2 are the (i-1)th and ith Fibonacci numbers, respectively
var
n1
,
n2
uint
=
0
,
1
for
i
:=
uint
(
1
);
i
<
n
;
i
++
{
n3
:=
n1
+
n2
n1
=
n2
n2
=
n3
}
return
n2
}
Back
|
FazBrowse Home
|
New Git URL