write a program to generate 1st n fibonacci prime number

Answer Posted / jagannath

#include<stdio.h>
#include<conio.h>

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 ?    4 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does it mean when the linker says that _end is undefined?

637


What is main () in c?

588


What is console in c language?

611


What is structure pointer in c?

574


What is double pointer in c?

591






Is javascript based on c?

595


Is boolean a datatype in c?

548


How old is c programming language?

581


Why does notstrcat(string, "!");Work?

644


Explain what is a 'locale'?

586


console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above

658


what is recursion in C

617


to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?

1574


Explain how can you check to see whether a symbol is defined?

664


How are 16- and 32-bit numbers stored?

725