-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesson_4.java
More file actions
47 lines (38 loc) · 865 Bytes
/
Lesson_4.java
File metadata and controls
47 lines (38 loc) · 865 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
39
40
41
42
43
44
45
46
47
public class Lesson_4 {
public static final int a = 100;
public static void main(String[] args) {
fun_3074(6);
}
private void fun_3() {
}
private static void fun_3074(int n) {
int a = 1;
int b = 1;
if (n < 3) {
System.out.println(1);
} else {
for (int i = 3; i <= n; i++) {
int c = a + b;
a = b;
b = c;
}
System.out.println(b);
}
}
private static void fun_1(int A) {
int a = 1;
int b = 2;
int count = 3;
while (b < A) {
int c = a + b;
a = b;
b = c;
count++;
}
if (b == A) {
System.out.println(count);
} else {
System.out.println(-1);
}
}
}