RosettaCodeData/Task/Fibonacci-sequence/C/fibonacci-sequence-2.c

10 lines
179 B
C
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
long long int fibb(int n) {
2026-04-30 12:34:36 -04:00
int fnow = 0, fnext = 1, tempf;
while(--n>0){
tempf = fnow + fnext;
fnow = fnext;
fnext = tempf;
}
return fnext;
2023-07-01 11:58:00 -04:00
}