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
Is using exit() the same as using return?
What is an lvalue in c?
diff between exptected result and requirement?
What is d'n in c?
What is c preprocessor mean?
Define VARIABLE?
How do you define CONSTANT in C?
What are the scope of static variables?
Explain what is the stack?
What is malloc return c?
What are the benefits of organizational structure?
How can you return multiple values from a function?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
Combinations of fibanocci prime series
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above