public int fibonacci(int n) {
if (n==1){
return 0;
}
if(n==2){
return 1;
}
n=n-2;
int a=0,b=1,k=0;
while(n-->0){
k=a+b;
a=b;
b=k;
}
return k;
}