Fibonacci series Without Recursion in java
Fibonacci series without recursion is the most important question in Java written interview questions. And its mainly ask all these java interview questions in the written exam.
Program or Solution:-
public static void main(String… s)
System.out.print(" Fibonacci series "+a+" "+b); // a is the first no and b is the second no
c=a+b; // c is the third no and it is sum of a + b
System.out.print(" "+c+" ");
a=b; // here we can replace the a with the value of b for next step
b=c; // here we can replace the b with the value of c for next step
Output:- Fibonacci series 0 1 1 2 3 5 8 13 21 34 55 89
Fibonacci series in the mathematics:–
The Fibonacci sequence is one of the most famous formulas in mathematics.
Each number in the sequence is the sum of the two numbers that precede it. So, the sequence goes: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, and so on. The mathematical equation describing it is Xn+2= Xn+1 + Xn
A mainstay of high-school and undergraduate classes, it’s been called “nature’s secret code,” and “nature’s universal rule.” It is said to govern the dimensions of everything from the Great Pyramid at Giza, to the iconic seashell that likely graced the cover of your school math textbook. read more.
Next >> Check Prime no in java