public static long fib(int n){
if (n==0){
return 0;
}
if (n==1){
return 1;
}
long fibA=0;
long fibB=1;
long fibC=0;
for (int i = 2;i<=n;i++){
fibC=fibA+fibB;
fibA=fibB;
fibB=fibC;
}
return fibC;
}