Fibonacci

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);
        }
}
 

Foxglove

Well-known member
Huh? I couldn't make any sense of this. You can find a bunch of information about the Fibonacci sequence, numbers, and Fibonacci himself in Wikipedia. Interesting stuff :) .
 
Foxglove said:
Huh? I couldn't make any sense of this. You can find a bunch of information about the Fibonacci sequence, numbers, and Fibonacci himself in Wikipedia. Interesting stuff :) .



lol it is code written in Java programming language to calculate a fibonacci sequence of 30 numbers with recursion

OP is so random lol
 

Foxglove

Well-known member
Scrabbl said:
Foxglove said:
Huh? I couldn't make any sense of this. You can find a bunch of information about the Fibonacci sequence, numbers, and Fibonacci himself in Wikipedia. Interesting stuff :) .



lol it is code written in Java programming language to calculate a fibonacci sequence of 30 numbers with recursion

OP is so random lol

Oh, OK, no wonder I didn't get it :lol: . A computer programmer I am not!
 
Top