Ad Code

Ticker

6/recent/ticker-posts

C Program To Print Fibonacci Number Between The Range a and b

C Program:

/*program to print fibonacci number in the range a b*/
#include<stdio.h>
#include<string.h>
void main()
{
int a,b,f2=1,f=0,f1=0;
clrscr();
printf("Enter the range a and b\n");
scanf("%d%d",&a,&b);
printf("the fibonacci number between %d and %d are\n",a,b);
for(;;)
{
f=f1+f2;
if(f>b)
break;
if(f>a)
printf("%d ",f);
f1=f2;
f2=f;
}
getch();

}


OUTPUT:


Reactions

Post a Comment

0 Comments

Ad Code