Write a c program to generate lucas series


















The program for the same is given below. Latest posts in C C Program to find factorial of a Number using While Loop C Program to Generate Multiplication Table C Program to add two numbers C program to find sum of first 10 integers using for loop C program to swap two numbers without using third variable C program to find factorial of a number using function C program to study while loop C program to study do-while loop C Program to study Bubble Sort C program to find largest among two numbers.

Related Articles. Table of Contents. Improve Article. Save Article. Like Article. Attention reader! Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a student-friendly price.

Previous Sum of numbers from 1 to N which are in Lucas Sequence. Skip to content. Change Language. Related Articles. Table of Contents. Improve Article. Save Article. Like Article. Last Updated : 11 May, While a Fibonacci sequence begins with 0 and 1, a Lucas sequence begins with 2 and 1 respectively.

The other successive terms of Lucas sequence are 3, 4, 7, 11 …. In this tutorial, we are going to write a Python code that would take a number n as input and print nth iteration of the Lucas sequence. This is a simple method. In this method, we create a recursive function as shown below to calculate the nth term adding the previous two terms. The first two terms are initialized as 2 and 1 as you can see in the program.



0コメント

  • 1000 / 1000