class FibonacciExample1{
public static void main(String args[])
int n1=0,n2=1,n3,i,count=10;
System.out.print(n1+""+n2);
for(i=2; i<count;++i)
{
n3=n1+n2;
System.out.print(""+n3):
n1=n2;
n2=n3;
}
}}
Answers
Explanation:
The Fibonacci sequence, also known as Fibonacci numbers, is defined as the sequence of numbers in which each number in the sequence is equal to the sum of two numbers before it. The Fibonacci Sequence is given as:
The Fibonacci sequence, also known as Fibonacci numbers, is defined as the sequence of numbers in which each number in the sequence is equal to the sum of two numbers before it. The Fibonacci Sequence is given as:Fibonacci Sequence = 0, 1, 1, 2, 3, 5, 8,
The Fibonacci sequence, also known as Fibonacci numbers, is defined as the sequence of numbers in which each number in the sequence is equal to the sum of two numbers before it. The Fibonacci Sequence is given as:Fibonacci Sequence = 0, 1, 1, 2, 3, 5, 8,13, 21, ....
I have actually written the program but I m not getting my note book. I searched my notebook for so long since I saw your question.
Fibonacci series program in JAVA without using recursion.
class FibonacciExample1{
public static void main(String args[])
{
int n1=0,n2=1,n3,i,count=10;
System.out.print(n1+" "+n2);
for(i=2;i<count;++i)
{
n3=n1+n2;
System.out.print(" "+n3);
n1=n2;
n2=n3;
}
}}