Fibonacci series

#include<stdio.h>
#include<conio.h>
Void main()
{
Int t1,t2,t3,n,i;
Clrscr();
Print("enter the limit=");
Scanf("%d",&n);
t1=0;t2=1;
For(i=1;i<=n;i++)
{
Print("%d",t1);
t3=t1+t2;
t1=t2;
t2=t3;
}
getch();
}
Output
             Enter the limit=5
                         0
                         1
                         1
                         2
                         3
                     




Comments

Post a Comment

Popular posts from this blog

Scan Converting a sStraight Line

DDA and Bresenham's Algorithm

priority&non priority scheduling