write a program to generate 1st n fibonacci prime number

Answer Posted / rajesh kumar s

int main()
{
int f=0,s=1,t=1,n,fl;
printf("enter the limit\t:");
scanf("%d",&n);
printf("\nfirst %d prime fibonacci numbers
are\n",n);
while(n)
{
fl=0;
fl=prime(f);
if(f>1 && fl==1)
{
printf("%d\t",f);
n=n-1;
}
s=t;
t=f;
f=s+t;
}
}

int prime(int x)
{
int i,f=0;
for(i=2;i<=x/2;i++)
{
if(x%i==0)
{
f=1;
break;
}
}
if(f==0)
{
return 1;
}
else
return 0;

}

Is This Answer Correct ?    26 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is using exit() the same as using return?

680


What is an lvalue in c?

697


diff between exptected result and requirement?

1596


What is d'n in c?

638


What is c preprocessor mean?

796






Define VARIABLE?

691


How do you define CONSTANT in C?

654


What are the scope of static variables?

601


Explain what is the stack?

637


What is malloc return c?

601


What are the benefits of organizational structure?

575


How can you return multiple values from a function?

635


Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?

571


Combinations of fibanocci prime series

1115


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

876