import java.util.Scanner;
import java.io.File;
public class FibonacciRec
{
public static long val = 0;
public static long total = 0;
public static long fibonacciRecursive(long n) {
val++;
if (n == 1 || n == 2) return 1;
total = fibonacciRecursive(n - 1) + fibonacciRecursive(n - 2);
return total;
}
public static void main(String args[])
{
Scanner scanner = null;
try
{
File file = new File(args[0]);
scanner = new Scanner(file);
while(scanner.hasNextLong())
{
System.out.println(fibonacciRecursive(scanner.nextLong()));
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
if (scanner != null)
{
scanner.close();
}
}
}
}
Comments