Skip to content

Commit 3dbe814

Browse files
Christian Benderthuva4
authored andcommitted
Fibonacci-Recursive.java : fixed compiler error (thuva4#557)
* fixed syntax error. renamed file according to the class name * changed formatting
1 parent 8d3c5f9 commit 3dbe814

3 files changed

Lines changed: 19 additions & 17 deletions

File tree

Fibonacci/Java/Fibonacci-Recursive.java

Lines changed: 0 additions & 17 deletions
This file was deleted.
970 Bytes
Binary file not shown.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class FibonacciRecursion {
2+
static int a = 0, b = 1, c = 0;
3+
4+
static void printFibonacci(int count) {
5+
if (count > 0) {
6+
c = a + b;
7+
a = b;
8+
b = c;
9+
System.out.printf("%d ", c);
10+
printFibonacci(count - 1);
11+
}
12+
}
13+
14+
public static void main(String args[]) {
15+
int count = 10;
16+
System.out.print(a + " " + b);
17+
printFibonacci(count - 2);
18+
}
19+
}

0 commit comments

Comments
 (0)