FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
basic-programs/java/recursion/Fibonacci.java at master · commitRahul/basic-programs · GitHub
commitRahul
/
basic-programs
Public
forked from
starVader/basic-programs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
basic-programs
/
java
/
recursion
/
Fibonacci.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (20 loc) · 434 Bytes
Breadcrumbs
basic-programs
/
java
/
recursion
/
Fibonacci.java
Copy path
File metadata and controls
22 lines (20 loc) · 434 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
22
class
Fibonacci
{
//recursive function
public
static
int
fibonacci
(
int
n
) {
if
(
n
<=
0
) {
return
0
; }
if
(
n
==
1
) {
return
1
; }
if
(
n
==
2
) {
return
1
; }
return
fibonacci
(
n
-
1
) +
fibonacci
(
n
-
2
);
}
public
static
void
main
(
String
[]
args
)
{
int
number
=
10
;
//number represents the number of terms in the series
for
(
int
i
=
0
;
i
<
number
;
i
++) {
System
.
out
.
printf
(
"%s "
,
fibonacci
(
i
));
}
}
}
Back
|
FazBrowse Home
|
New Git URL