Lucas numbers: It is similar to Fibonacci numbers, each Lucas number is defined to be the sum of its two immediate previous terms Where as the first two number are 2 and 1.
The Lucas numbers are as following :
2 1 3 4 7 11 18 29 47 76
#include<stdio.h>
#include<conio.h>
int main()
{
int x,y,z,num;
printf("Enter the limit of Lucas number : ");
scanf("%d",&num);
x=2;
y=1;
while(num>=x)
{
printf(" %d",x);
z=x+y;
x=y;
style="background-color: white; font-size: large;"> y=z;
/***************Output***************
Related Programs:
}
getch();
getch();
return 0;
}
/***************Output***************
Enter the limit of Lucas number : 125
2 1 3 7 11 18 29 47 76 123
************************************/
************************************/
Related Programs:
- Amicable number C program
- Perfect number C program
- Armstrong number C program
- Print Armstrong number range C program
- Fibonacci series C program
- Generate Fibonacci series using recursion
- Search number is Fibonacci or not
0 comments:
Post a Comment