1/*Program to print the Lucas series for n terms.*/
2
3#include <iostream>
4using namespace std;
5
6int main()
7{
8 int n, i, t1 = 2, t2 = 1, tn;
9 cout << "Enter the number of terms desired in the lucas series: ";
10 cin >> n;
11
12 if (n == 1)
13 cout << endl << 2 << endl;
14 else if (n == 2)
15 cout << endl << 2 << endl << 1 << endl;
16 else if (n > 2)
17 {
18 cout <<endl<<"Lucas series for "<< n<< " terms is:"<<endl<< t1 << endl << t2 << endl;
19 for (i = 0; i < n-2; i++)
20 {
21 tn = t1 + t2;
22 cout << tn << endl;
23 t1 = t2;
24 t2 = tn;
25
26 }
27 }
28
29 return 0;
30}
31