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 ?    10 Yes 4 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 ?    2 Yes 2 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 ?    2 Yes 1 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 ?    2 Yes 2 No
Rajesh Kumar S
 
  Re: write a program to generate 1st n fibonacci prime number
Answer
# 5
#include<stdio.h>
#include<conio.h>
int main()
{
int n,a=1,b,c=0,d=0,i,j;
printf("\nenter the number ");
scanf("%d",&n);
printf("\nThe fibbonacci prime numbers are ");
for(i=0;i<=n-1;i++)
{
b=c+a;
a=c;
c=b;
j=2;
while(j<=b-1)
    {

		   if(b%j==0)
		   {

			       break;
		   }
		   j++;
    }
    if(j==b)
    {
      printf("\n%d",b);
    }

}
getch();
}
 
Is This Answer Correct ?    0 Yes 1 No
Ruchi
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is the advantage of using SEMAPHORES to ORDINARY VARIABLES??? NSN1
What character terminates all strings composed of character arrays? 1) 0 2) . 3) END  3
write a function which accept two numbers from main() and interchange them using pointers?  3
Reverse the part of the number which is present from position i to j. Print the new number.[without using the array] eg: num=789876 i=2 j=5 778986  2
CopyBits(x,p,n,y) copy n LSBs from y to x starting LSB at 'p'th position. Adobe4
Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types? Excel1
What are the commands should be given before weiting C Program i.e, Cd.. like Infonet3
which type of question asked from c / c++ in interview.  2
What is structure padding ? HP2
main() { int x=10,y=15; x=x++; y=++y; printf("%d %d\n",x,y); } output?? Ramco13
Add 2 64 bit numbers on a 32 bit machine NetApp3
which one low Priority in c? a)=,b)++,c)==,d)+  8
Which of the following is not an infinite loop ? a.while(1){ .... } b.for(;;){ ... } c.x=0; do{ /*x unaltered within theloop*/ ... }while(x==0); d.# define TRUE 0 ... while(TRUE){ .... } TCS4
logic for generating all the combinations of the any number of given letters. ex::::::::: if a,b,c,d are given the o/p should be abcd,dcba,dbac,bcad,................ 4*3*2*1 combinations............ Infosys2
totally how much header files r in c language TCS4
If "AaBbCc" is passed to the char char x(*a) { a[0]?x(a+1):1; printf("%c",a[0]); return 1; } what will be the output? Hughes5
Result of the following program is main() { int i=0; for(i=0;i<20;i++) { switch(i) case 0:i+=5; case 1:i+=2; case 5:i+=5; default i+=4; break;} printf("%d,",i); } } a)0,5,9,13,17 b)5,9,13,17 c)12,17,22 d)16,21 e)syntax error IBM4
4.weight conversion: Write a program that will read weight in pounds and convert it into grams.print both the original weight and the converted value.There are 454 grams in a pound.design and carry out a test plan for this program. Wipro1
#ifdef TRUE int I=0; #endif main() { int j=0; printf("%d %d\n",i,j); } ADITI2
How does free() know how many bytes to free?  5
 
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