-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwhile26.java
More file actions
30 lines (24 loc) · 592 Bytes
/
while26.java
File metadata and controls
30 lines (24 loc) · 592 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
package whileGita;
import java.util.Scanner;
public class while26 {
public static void main(String[] args) {
int n;
Scanner scanner=new Scanner(System.in);
System.out.print("N:");
n = scanner.nextInt();
int f1 = 1;
int f2 = 1;
int f = 0;
while (f < n)
{
f = f2 + f1;
f2 = f1;
f1 = f;
}
System.out.print("F_k - 1 =");
System.out.print(f2);
System.out.print("\n");
System.out.print("F_k+1=");
System.out.print(f1 + f2);
}
}