Answer: Fibonacci series is a series of numbers where after the initial two numbers, every occurring number is the sum of two preceding numbers.
For Example 0,1,1,2,3,5,8,13,21………
1 | import java.util.Scanner; |
3 | public class Fibonacci { |
4 | public static void main(String[] args) { |
5 | int num, a = 0 ,b= 0 , c = 1 ; |
6 | Scanner in = new Scanner(System.in); |
7 | System.out.println( "Enter the number of times" ); |
9 | System.out.println( "Fibonacci Series of the number is:" ); |
10 | for ( int i= 0 ; i<=num; i++) { |
14 | System.out.println(a + "" ); |
Output:
Enter the number of times
9
Fibonacci Series of the number is:
0
1
1
2
3
5
8
13
21
34