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
#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
Nice
ReplyDeleteNice
ReplyDeleteNice bro
ReplyDeleteSuper da
ReplyDeletefantastic
ReplyDelete