public class test {
public static void main(String[] args)
{
System.out.println(Fib(7));
reverseNum(528945524);
}
public static int Fib(int index)
{
if(index<1||index>10000)
return -1;
else if(index==1)
{
return 1;
}else if(index==2)
{
return 1;
}else{
return Fib(index-1)+Fib(index-2);//递归
}
}
public static void reverseNum(int number)
{
if(number<0)
System.out.println("please enter a positive number");//尽量输入正数吧,你可以改,让它支持负数
else{
int result;
int temp=number;
do{
result=temp%10;
temp = temp/10;
System.out.print(result);
}while(temp>0);
System.out.println();
}
}
}