This program is to display or generate Fibonacci series up to given input range. In the below given program, input variable is declared as $input_Num.
What is Fibonacci Series?
Addition of current number with preceding number is called as Fibonacci Series. Example, (0 + 1 = 1), (1 + 1 = 2), (2 + 1 = 3), (3 + 2 = 5)... and goes on. Result is 0,1,1,2,3,5....
Programming Logic:
What is Fibonacci Series?
Addition of current number with preceding number is called as Fibonacci Series. Example, (0 + 1 = 1), (1 + 1 = 2), (2 + 1 = 3), (3 + 2 = 5)... and goes on. Result is 0,1,1,2,3,5....
Programming Logic:
- Get the first number in variable $First_Num as 0 and second number in variable $Second_Num as 1.
- First add $Second_Num and $First_Num and store it in $result variable.
- Now change $First_Num as $Second_Num and $Second_Num as $First_Num
- Loop the process again and again up to input limit.
1,2,3,5,8,13,21,34,55,89,
Click Here to get -- > Php Tutorials by Studentsblog100
No comments:
Post a Comment