sabbath92001
Banned
This site has plenty of reading and writing. But where is the arithmetic?
Code:
public class Fibonacci
{
public static void main(String[] args)
{
int ndx=0;
System.out.print("\nThe first thirty Fibonacci numbers are: ");
for (ndx=0; (ndx<=30); ndx++)
{
System.out.print(fibonacci(ndx));
if (ndx!=30)
System.out.print(", ");
if ((ndx%10)==0 && ndx!=0)
System.out.println();
}
}
public static long fibonacci(int ndx)
{
long number = 0;
if (ndx==0 || ndx==1)
number = ndx;
else
number = fibonacci(ndx-1) + fibonacci(ndx-2);
return (number);
}
}