java program to print fibonacci series

admin February 18, 2014 0 Comments

fibonacci series

java-Fibnocassi mkjgvfhffdfdrdclass Fibonacci
{
public static void main ( String s [] )
{ int n2 =1 ;int n1 =0 ;
System.out.println(n1);
System.out.println (n2);
int sum ;
for ( int i = 0;i <25 ;i++)
{
sum = n1+n2;
n1 = n2 ;
n2 = sum;
System.out.println ( sum );
}


}
}

 

Leave a Reply