Definition of Fibonacci numbers:
We assume first two Fibonacci are 0 and 1
A series of numbers in which each sequent number is sum of its two previous numbers is known as Fibonacci series and each numbers are called Fibonacci numbers. So Fibonacci numbers is
Example of Fibonacci series:
0 , 1 ,1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 ...
#include<stdio.h>
#include<conio.h>
int main()
{
int k,r;
long int i=0l,j=1,f;
//Enter max and min number
printf("Enter the number range:");
scanf("%d",&r);
printf("FIBONACCI SERIES: ");
printf("%ld %ld",i,j); //printing firts two values.
for(k=2; k<=r; k++)
{
f=i+j;
i=j;
j=f;
printf(" %ld",j);
}
return 0;
}
#include<conio.h>
int main()
{
int k,r;
long int i=0l,j=1,f;
//Enter max and min number
printf("Enter the number range:");
scanf("%d",&r);
printf("FIBONACCI SERIES: ");
printf("%ld %ld",i,j); //printing firts two values.
for(k=2; k<=r; k++)
{
f=i+j;
i=j;
j=f;
printf(" %ld",j);
}
return 0;
}
Enter the number range: 15
FIBONACCI SERIES: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
#include<stdio.h>
#include<conio.h>
#include<conio.h>
int main()
{
{
int i,range;
long int arr[40];
printf("Enter the number range: ");
scanf("%d",&range);
arr[0]=0;
arr[1]=1;
for(i=2; i<=d; i++)
{
arr[i] = arr[i-1] + arr[i-2];
}
printf("Fibonacci series is: ");
for(i=0; i<=d; i++)
{
printf("%ld ",arr[i]);
}
return 0;
}
Enter the number range: 20
Fibonacci series is: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181
#include<stdio.h>
#include<conio.h>
int main()
{
{
int k=2,r;
long int i=0l,j=1,f;
printf("Enter the number range:");
scanf("%d",&r);
printf("Fibonacci series is: %ld %ld",i,j);
while(k<=d)
{
f=i+j;
i=j;
j=f;
printf(" %ld",j);
k++;
}
return 0;
}
Enter the number range: 10
Fibonacci series is: 0 1 1 2 3 5 8 13 21 34
ConversionConversion EmoticonEmoticon