MCPcopy Create free account
hub / github.com/SR-Sunny-Raj/Hacktoberfest2021-DSA / BIG

Class BIG

32. Java Programs/fibbonacci.java:3–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1// Java program for the above approach
2
3class BIG {
4
5 // Function to print N Fibonacci Number
6 static void Fibonacci(int N)
7 {
8 int num1 = 0, num2 = 1;
9
10 int counter = 0;
11
12 // Iterate till counter is N
13 while (counter < N) {
14
15 // Print the number
16 System.out.print(num1 + " ");
17
18 // Swap
19 int num3 = num2 + num1;
20 num1 = num2;
21 num2 = num3;
22 counter = counter + 1;
23 }
24 }
25
26 // Driver Code
27 public static void main(String args[])
28 {
29 // Given Number N
30 int N = 10;
31
32 // Function Call
33 Fibonacci(N);
34 }
35}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected