#include<stdio.h>
#include<conio.h>
void fibonacci(int n)
{
int i,a=1,b=0,temp;
for(i=0;i<n;i++)
{
temp=b;
b+=a;
printf(" %d",b);
a=temp;
}
}
void main()
{
int limit;
clrscr();
printf("\nEnter the limit N : ");
scanf("%d",&limit);
puts("\n The fibonaci :\n");
fibonacci(limit);
getch();
}
Algorithm
fibonacci(n)
step1: Start
step2: intilize a<-1 b="" br="" i="">step3: check whether i else go to step 10
step4: temp=b
step5: b=b+a
step6: print b
step7: a=temp
step8: i=i+1
step9: go to step 3
step10: stop
main()
step1: start
step2: read limit
step3: call fibonacci(limit)
step4: stop -1>
#include<conio.h>
void fibonacci(int n)
{
int i,a=1,b=0,temp;
for(i=0;i<n;i++)
{
temp=b;
b+=a;
printf(" %d",b);
a=temp;
}
}
void main()
{
int limit;
clrscr();
printf("\nEnter the limit N : ");
scanf("%d",&limit);
puts("\n The fibonaci :\n");
fibonacci(limit);
getch();
}
Algorithm
fibonacci(n)
step1: Start
step2: intilize a<-1 b="" br="" i="">step3: check whether i
step4: temp=b
step5: b=b+a
step6: print b
step7: a=temp
step8: i=i+1
step9: go to step 3
step10: stop
main()
step1: start
step2: read limit
step3: call fibonacci(limit)
step4: stop