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
What happens if you free a pointer twice?
What is wrong with this program statement?
Explain the use of #pragma exit?
What is selection sort in c?
c language interview questions & answer
What are the different data types in C?
How to declare a variable?
What is typeof in c?
what is uses of .net
What is d'n in c?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
What is derived datatype in c?
What are c preprocessors?
Explain 'bit masking'?
How will you write a code for accessing the length of an array without assigning it to another variable?