text: Pell Number | Iterative Pell Number Series in C ; calculate nth pell number ; driver function
code: #include <stdio.h> NEW_LINE int pell ( int n ) { if ( n <= 2 ) return n ; int a = 1 ; int b = 2 ; int c , i ; for ( i = 3 ; i <= n ; i ++ ) { c = 2 * b + a ; a = b ; b = c ; } return b ; } int main ( ) { int n = 4 ; printf ( " % d " , pell ( n ) ) ; return 0 ; }