| 1 | // Java program for the above approach |
| 2 | |
| 3 | class 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected