From 61bb10ed0e9f6231bd7e9f68fb185a2971e3e579 Mon Sep 17 00:00:00 2001 From: Monalika Date: Wed, 26 May 2021 16:18:40 +0530 Subject: [PATCH] Create Print Lucas Series Upto N terms.cpp --- Print Lucas Series Upto N terms.cpp | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Print Lucas Series Upto N terms.cpp diff --git a/Print Lucas Series Upto N terms.cpp b/Print Lucas Series Upto N terms.cpp new file mode 100644 index 0000000..0bd01ce --- /dev/null +++ b/Print Lucas Series Upto N terms.cpp @@ -0,0 +1,31 @@ +/*The Lucas series is an integer series very similar to the Fibonacci series, named after the French mathematician François Édouard Anatole Lucas. Each term of the Lucas series is defined as the sum of the previous two terms of the series with the first two terms being 2 and 1 respectively. The Lucas series and Fibonacci series are complementary to each other. Given below is the code to find the Terms of the Lucas series up to n iterations.*/ +/*Program to print the Lucas series for n terms.*/ + +#include +using namespace std; + +int main() +{ + int n, i, t1 = 2, t2 = 1, tn; + cout << "Enter the number of terms desired in the lucas series: "; + cin >> n; + + if (n == 1) + cout << endl << 2 << endl; + else if (n == 2) + cout << endl << 2 << endl << 1 << endl; + else if (n > 2) + { + cout <