-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathProblem2.java
More file actions
38 lines (34 loc) · 908 Bytes
/
Problem2.java
File metadata and controls
38 lines (34 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package io.zipcoder;
public class Problem2 {
//I couldn't gert the math right :-(
public String fibonacciIteration(int value) {
int first = 0, next = 1, result = 0;
String toReturn = "0 ";
do {
first = result;
result = first + next;
toReturn += result + " ";
next = result;
} while (result != value);
return toReturn;
}
//Should have gotten started on this one ;-(
public String fibonacciRecursion(int value) {
return null;
}
}
//double prev=0d, next=1d, result=0d;
// for (int i = 0; i < n; i++) {
// result=prev+next;
// prev=next;
// next=result;
// }
// return result;
// int f = 0;
// int g = 1;
//
// for (int i = 1; i <= 10; i++) {
// System.out.print(f + " ");
// f = f + g;
// g = f - g;
// }