Java, Selenium , Testing and Interview Questions and answers
Pages
Home
Java Programming
Selenium testNG Junit
Testing
Interview Questions
Showing posts with label
Fibonacci series
.
Show all posts
Showing posts with label
Fibonacci series
.
Show all posts
Saturday, August 18, 2012
Printing the Fibonacci Series using Java
public class FibonaciN {
public static void main(String args[])
{
int prev, next, sum, n;
prev=next=1;
for(n=1;n<=9;n++)
{
System.out.println(prev);
sum=prev+next;
prev=next;
next=sum;
}
}
}
Older Posts
Home
Subscribe to:
Posts (Atom)