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       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
write a program to generate 1st n fibonacci prime number
 Question Submitted By :: Vasu
I also faced this Question!!     Rank Answer Posted By  
 
  Re: write a program to generate 1st n fibonacci prime number
Answer
# 1
void main()
{
int x1,x2,x3,n,i;
x1=0;
x2=1;
printf("enter a value for n : ");
scanf("%d",&n);
printf("%d %d ",x1,x2);
for(i=3;i<=n;i++)
{
x3=x1+x2;
printf("%d ",x3);
x1=x2;
x2=x3;
}
}
 
Is This Answer Correct ?    2 Yes 1 No
Yagneswara Babu
 
  Re: write a program to generate 1st n fibonacci prime number
Answer
# 2
void main()
{
int x1,x2,x3,i;
x1=-1;
x2=1;
printf("enter the value for n  :");
scanf("%d",&n);
print
for(i=0;i<n;i++)
{
x3=x1+x2;

if((x3 mod 2)!=0)
{
printf("%d   ",x3)
}
x1=x2;
x2=x3;
}

}
 
Is This Answer Correct ?    1 Yes 0 No
Gayathri
 
 
 
  Re: write a program to generate 1st n fibonacci prime number
Answer
# 3
void main()
{
int x1,x2,x3,i,n;
x1=-1;
x2=1;
printf("enter the value for n  :");
scanf("%d",&n);
print
for(i=0;i<n;i++)
{
x3=x1+x2;

if((x3 mod 2)!=0)
{
printf("%d   ",x3)
}
x1=x2;
x2=x3;
}

}
 
Is This Answer Correct ?    1 Yes 0 No
Rose
 
  Re: write a program to generate 1st n fibonacci prime number
Answer
# 4
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 ?    0 Yes 1 No
Rajesh Kumar S
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
helllo sir give me some information of the basic information the c as printf ,scanf , %d ,%f and why is the main use of these.  3
what is the difference between const char *p, char const *p, const char* const p Accenture3
write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language  1
What is Heap?  3
how to generate the length of a string without using len funtion?  3
HOW DO YOU HANDLE EXCEPTIONS IN C? AppLabs2
difference between my-strcpy and strcpy ? Geometric-Software3
10. Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning Accenture4
how to estimate the disk access time? e.g. the time between read one byte and another byte in the disk. Google3
Write a program in c to input a 5 digit number and print it in words.  1
What is the value of y in the following code? x=7;y=0; if(x=6) y=7; else y=1; TCS10
Difference between fopen() and open()? Aricent1
How would you print out the data in a binary tree, level by level, starting at the top?  3
what about "char *(*(*a[])())();" Oracle2
Program to find the value of e raised to power x using while loop N-Tech3
What is C language Terminator? TCS12
What is macro? IBM3
What is function pointer and where we will use it NetApp1
how does the for loop work actually..suppose for the following program how it ll work plz explain to me for(i=5;i>=0;i--) prinf(i--); RMSI13
How do you write a program which produces its own source code as its output?  2
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
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