Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int n1=0,n2=1,n,sum=0;
clrscr();
printf("\nEnter the limit of the series");
scanf("%d",&n);
printf("\n%d",n1);
printf("\n%d",n2);
while(sum<n)
{
sum=n1+n2;
n1=n2;
n2=sum;
printf("\n%d",sum);
}
getch();
}
Output:
What is Fibonacci series ?
the series which is obtained by addition of two previous no is called Fibonacci series.
#include<stdio.h>
#include<conio.h>
void main()
{
int n1=0,n2=1,n,sum=0;
clrscr();
printf("\nEnter the limit of the series");
scanf("%d",&n);
printf("\n%d",n1);
printf("\n%d",n2);
while(sum<n)
{
sum=n1+n2;
n1=n2;
n2=sum;
printf("\n%d",sum);
}
getch();
}
Output:
What is Fibonacci series ?
the series which is obtained by addition of two previous no is called Fibonacci series.
Great Work.. I saw One more easiest way to Write a C Program To Print Fibonacci Series
ReplyDelete