Skip to content

Commit 776c3c6

Browse files
Rename FibToN.java to FibbonaciSeries.java (TheAlgorithms#2498)
1 parent f1ec159 commit 776c3c6

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Others/FibToN.java renamed to Others/FibbonaciSeries.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@
99
* <p>Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21,...
1010
*
1111
* <p>Source for the explanation: https://en.wikipedia.org/wiki/Fibonacci_number
12+
*
13+
* Problem Statement: print all Fibonacci numbers that are smaller than your given input N
1214
*/
13-
public class FibToN {
15+
public class FibbonaciSeries {
1416
public static void main(String[] args) {
15-
// take input
16-
Scanner scn = new Scanner(System.in);
17-
int N = scn.nextInt();
18-
// print all Fibonacci numbers that are smaller than your given input N
17+
// Get input from the user
18+
Scanner scan = new Scanner(System.in);
19+
int n = scan.nextInt();
1920
int first = 0, second = 1;
20-
scn.close();
21-
while (first <= N) {
21+
scan.close();
22+
while (first <= n) {
2223
// print first fibo 0 then add second fibo into it while updating second as well
23-
2424
System.out.println(first);
25-
2625
int next = first + second;
2726
first = second;
2827
second = next;

0 commit comments

Comments
 (0)