package one;
import static java.lang.System.out;
public class Sequence
{
public static void main(String[] args)
{
fibonacciSequence();
out.println("----------------------------------");
out.println("第12个月的数量为:"+fibonacci(12)+"对");
}
public static void fibonacciSequence()
{
int a=1;
int b=1;
int n=1;
out.println("第"+n+"个月的数量为:"+b+"对");
while(n<=12)
{
if(++n<=12)
{
a=a+b;
out.println("第"+n+"个月的数量为:"+a+"对");
}
else
{
break;
}
if(++n<=12)
{
b=a+b;
out.println("第"+n+"个月的数量为:"+b+"对");
}
}
}
public static int fibonacci(int n)
{
if(n==0)
{
return 1;
}
if(n==1)
{
return 1;
}
return fibonacci(n-1)+fibonacci(n-2);
}
}