Scanner i = new Scanner (System.in); System.out.println("Given a number n, this program will return the N-th Fibonacci number in an interger type.\n"); do { int number = 0; System.out.print ("Please input your number: "); number = i.nextInt(); System.out.printf (" The %d-th is fibinocci number is %.0f\n",number, fibcalic(number)); } while (number != 0); } } // end main method public static int fibcalic(int number)// method { int max = number; int[] fibarray = new int [max];// set the array to int max is still int fibarray [0] = 0; fibarray [1] = 1; for (int a=2; a < max; a++) { fibarray[a] = fibarray[a -1] + fibarray[a -2]; } return fibarray[number]; }

This post has been edited by **jon.kiparsky**: 10 January 2013 - 07:52 AM

Reason for edit:: fixed [code] tags