Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int pell(int n)
- {
- int n2 = 2, n1 = 2;
- for(int i=0;i<n;i++)
- {
- n1 = n2;
- n2 = n1 * 2 + n2;
- }
- return n2;
- }
- int main()
- {
- int n = 10;
- pell(10);
- std::cout << pell(10) << " " << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement