#include<stdio.h>
void main()
{
int t,i,m=0,n=1,f=1;
printf("\n\nEnter the number of terms:");
scanf("%d",&t);
printf("\n The Fibonacci Series of %d terms:\n",t);
for(i=1;i<=t;i++)
{
printf("%d\t",f);
f=m+n;
m=n;
n=f;
}
}
#include<stdio.h>
void main()
{
int t,i,m=0,n=1,f=1;
printf("\n\nEnter the number of terms:");
scanf("%d",&t);
printf("\n The Fibonacci Series of %d terms:\n",t);
for(i=1;i<=t;i++)
{
printf("%d\t",f);
f=m+n;
m=n;
n=f;
}
}
Output
Enter the number of terms:10
The Fibonacci Series of 10 terms:
1 1 2 3 5 8 13 21 34 55
0 Comments