ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories >> Software >> Programming-Languages >> C
 
 
 
Question
write a program to generate 1st n fibonacci prime number
 Question Submitted By :: Vasu
I also faced this Question!!     Rank Answer Posted By  
 
Answer
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;

}
 
0
Rajesh Kumar S
 
View All Answers
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com