Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What happens if you free a pointer twice?

1089


What is wrong with this program statement?

1048


Explain the use of #pragma exit?

1183


What is selection sort in c?

1111


c language interview questions & answer

1969


What are the different data types in C?

1210


How to declare a variable?

1015


What is typeof in c?

1018


what is uses of .net

1742


What is d'n in c?

1126


Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?

1009


What is derived datatype in c?

1102


What are c preprocessors?

1207


Explain 'bit masking'?

1096


How will you write a code for accessing the length of an array without assigning it to another variable?

1059