#include<stdio.h>
main()
{
int a=1,b=1,i=1,n,temp;
printf("\nEnter number of terms=");
scanf("%d",&n);
printf("\nThe fibonacci series is\n");
while(i<=n)
{
printf("%d ",a);
temp=a;
a=b;
b=temp+a;
i++;
}
}
main()
{
int a=1,b=1,i=1,n,temp;
printf("\nEnter number of terms=");
scanf("%d",&n);
printf("\nThe fibonacci series is\n");
while(i<=n)
{
printf("%d ",a);
temp=a;
a=b;
b=temp+a;
i++;
}
}
No comments:
Post a Comment