Filter by Tags

Write a program to print fibonacci series.

Votes

0

0 0
This Question is asked to:

In mathematics, the Fibonacci series sequence are the numbers in the following integer sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...

Manish Rawat
Posted on : Wed, Jan 24, 2018
Views : 101
Comments

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Answers (1)


0
class FibonacciExample1{

public static void main(String args[])
{ 
int n1=0,n2=1,n3,i,count=10; 
System.out.print(n1+" "+n2);//printing 0 and 1 

for(i=2;i<count;++i)//loop starts from 2 because 0 and 1 are already printed 
{ 
n3=n1+n2; 
System.out.print(" "+n3); 
n1=n2; 
n2=n3; 
}

}}



Jaspreet kaur
Thu, Jan 25, 2018
Loading...
Comments

Edit Answer

Submit
This answer will permanently deleted. Do you really want to delete this Answer ?
To Add your Answer Please
LogIn | SignUp

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp