#include
#include
void fiab(int n)
{
int a=0,b=1,add=0;
printf("%d %d ",a,b);
while(add
{
add=a+b;
a=b;
b=add;
printf("%d ",a);
}
}
void main()
{
int i,j,a,b;
clrscr();
printf("\n Enter number to print fibonacci number:\n");
scanf("%d",&a);
printf("\n Fiabonacci series:\n");
fiab(a);
getch();
}
#include
void fiab(int n)
{
int a=0,b=1,add=0;
printf("%d %d ",a,b);
while(add
{
add=a+b;
a=b;
b=add;
printf("%d ",a);
}
}
void main()
{
int i,j,a,b;
clrscr();
printf("\n Enter number to print fibonacci number:\n");
scanf("%d",&a);
printf("\n Fiabonacci series:\n");
fiab(a);
getch();
}
No comments:
Post a Comment