#include<stdio.h>
void main()
int i,n,prev,current,next;
clrscr();
printf("Enter the no.of terms : ");
scanf("%d",&n);
prev=0;
current=1;
printf("\nFibonacci series : \n");
for(i=1;i<=n;i++)
{
printf("%d\t",prev);
next=prev+current;
prev=current;
current=next;
}
getch();
}
No comments:
Post a Comment