Lucas Sequence C Program

 

C Program To Print Lucas Sequence

Learn how to print Lucas sequence in C programming language. It is important that we should know How A For Loop Works before getting further with the C program code.

With the code below, you can print the first N terms of Lucas Series in C programming.

 

What is a Lucas Sequence?

A Lucas series is a sequence of numbers which the next number is calculated by adding the immediate preceding two consecutive numbers.

Note: The first two digits in a Lucas series are always 2 and 1.

To generate N terms in a Lucas series, the first digit in the sequence should be 2 and the next digit should be 1, which is basically hard-coded. The next digit, which is called as Lucas number, is derived by

The next digit, which is called as Lucas number, is derived from the sum of the preceding two digits in the sequence. This addition and generation of Lucas sequence go till the limit.

Example

2 1 3 4 7 11 18 29 47 76 143 219

Method 1: C Program To Print Lucas series using For Loop

Method 2: C Program To Generate First N Terms of Lucas sequence using Function

   

Output

C Program To Generate N Terms in Lucas Sequence using For Loop and Functions

In case you get any compilation errors in the above program to print first N terms of Lucas sequence in C programming language using For Loop and Functions or if you have any doubts about it, let us know about it in the comment section below.

Recommended Programs
C Program To Print Tribonacci Series
C Program To Calculate Distance Between Two Points
C Program To Create Your Header File
C Program To Print Fibonacci Series
C Program To Replace A Character in String
C Program To Find Union and Intersection of Two Sets
C Program To Find Armstrong Number
C Program To Evaluate A Polynomial
C Program To Display Digital Clock
C Program To Find Trace and Normal of Matrix
100+ C Programs For Programming Interviews

2 thoughts on “Lucas Sequence C Program

  1. Ramesh Vaidya

    This is just so similar to Fibonacci sequences. I didn’t even know that anything called as Lucas series exists. Thanks.

    Reply

Let's Discuss