Skip to content

Commit f9747bf

Browse files
Create PrintFibonacciSeries.java
1 parent 25e620e commit f9747bf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: src/PrintFibonacciSeries.java

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
public class PrintFibonacciSeries {
2+
3+
public static void printFibonacciSeries(int count) {
4+
int a = 0;
5+
int b = 1;
6+
int c = 1;
7+
for (int i = 1; i <= count; i++) {
8+
System.out.print(a + ", ");
9+
a = b;
10+
b = c;
11+
c = a + b;
12+
}
13+
}
14+
15+
public static void main(String args[]) {
16+
17+
// don't exceed it hehe
18+
printFibonacciSeries(40);
19+
20+
}
21+
}

0 commit comments

Comments
 (0)