Friday 10 February 2012

how to find fibonacci numbers upto a limit


#include<stdio.h>
main()
{
int a=1,b=0,c=0,n;
printf("enter the limit:");
scanf("%d",&n);
while(c<n)
{
printf("\t%d",c);
c=a+b;
a=b;
b=c;
}
}

No comments:

Post a Comment