text: Pell Number | Iterative Pell Number Series in C ++ ; Calculate nth pell number ; Driver Code
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; 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 ; cout << pell ( n ) ; return 0 ; }