29. Program to Display Fibonacci Series Get link Facebook X Pinterest Email Other Apps - August 26, 2015 Get link Facebook X Pinterest Email Other Apps Comments Unknown2:53 PMThis comment has been removed by the author.ReplyDeleteRepliesReplyUnknown2:57 PM#includeint main(){ int k,r; long int i=0l,j=1,f; clrscr(); printf("Enter the number range:"); scanf("%d",&r); printf("FIBONACCI SERIES: "); printf("%ld %ld",i,j); for(k=2;k<r;k++){ f=i+j; i=j; j=f; printf(" %ld",j); } getch();}ReplyDeleteRepliesReplyUnknown2:58 PMvoid main(){int t1=0,t2=1,t3,n,i;clrscr();printf("Enter number of terms");scanf("%d",&n);printf("The fibonacci series is");printf("%d %d",t1,t2);for(i=0;i<n;i++){t3=t1+t2;t1=t2;t2=t3;printf("\t%d",t3);}getch();}ReplyDeleteRepliesReplyUnknown2:59 PMProgram to Display Fibonacci Series#include#includevoid main(){ int no ,no1,no2,no3,i=0,pos=4; clrscr(); printf("Enter the first no:"); scanf("%d",&no1); printf("Ente rthe second no:"); scanf("%d",&no2); while(i<=pos) { no=no1+no2; printf("\n \t no=%d",no); no1=no2; no2++; i++; } getch();}ReplyDeleteRepliesReplyAdd commentLoad more... Post a Comment
This comment has been removed by the author.
ReplyDelete#include
ReplyDeleteint main(){
int k,r;
long int i=0l,j=1,f;
clrscr();
printf("Enter the number range:");
scanf("%d",&r);
printf("FIBONACCI SERIES: ");
printf("%ld %ld",i,j);
for(k=2;k<r;k++){
f=i+j;
i=j;
j=f;
printf(" %ld",j);
}
getch();
}
void main()
ReplyDelete{
int t1=0,t2=1,t3,n,i;
clrscr();
printf("Enter number of terms");
scanf("%d",&n);
printf("The fibonacci series is");
printf("%d %d",t1,t2);
for(i=0;i<n;i++)
{
t3=t1+t2;
t1=t2;
t2=t3;
printf("\t%d",t3);
}
getch();
}
Program to Display Fibonacci Series
ReplyDelete#include
#include
void main()
{
int no ,no1,no2,no3,i=0,pos=4;
clrscr();
printf("Enter the first no:");
scanf("%d",&no1);
printf("Ente rthe second no:");
scanf("%d",&no2);
while(i<=pos)
{
no=no1+no2;
printf("\n \t no=%d",no);
no1=no2;
no2++;
i++;
}
getch();
}