피보나치(2)
-
피보나치 수열 n번째 항
Test.java import java.util.Scanner; public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int i; System.out.println("입력:"); i=scan.nextInt(); Fibonacci fib = new Fibonacci(); System.out.println("피보나치 수열"); System.out.println("f"+ i + " : " + fib.fibR(i)); } } Fibonacci.java public class Fibonacc..
2011.03.17 -
피보나치 수열
Test.java public class Test{ /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int i=8; Fibonacci fib = new Fibonacci(); System.out.println(" 피~ " + i + " 번째 값 : " + fib.fibR(i)); } } Fibonacci.java public class Fibonacci { public int fibR(int n) { if(n
2011.03.17