//Program to print Fibonacci series using while loop.
#include<stdio.h>
#include<conio.h>
void fib(int);
void main()
{
int n;
clrscr();
printf("Enter the number upto which u want to find fibnacci series");
scanf("%d",&n);
fib(n);
getch();
}
void fib(int x)
{
int a=0,b=1,c;
c=a+b;
printf(" %d %d ",a,b);
while(c<=x)
{
printf(" %d ",c);
a=b;
b=c;
c=a+b;
}
}
#include<stdio.h>
#include<conio.h>
void fib(int);
void main()
{
int n;
clrscr();
printf("Enter the number upto which u want to find fibnacci series");
scanf("%d",&n);
fib(n);
getch();
}
void fib(int x)
{
int a=0,b=1,c;
c=a+b;
printf(" %d %d ",a,b);
while(c<=x)
{
printf(" %d ",c);
a=b;
b=c;
c=a+b;
}
}