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
What are the header files used in c language?
show how link list can be used to repersent the following polynomial i) 5x+2
What does c in a circle mean?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
what are non standard function in c
What is #define size in c?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
What is indirection in c?
I need a sort of an approximate strcmp routine?
What is main function in c?
write a program to find the given number is prime or not
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
What is #include stdio h?
What is the maximum length of an identifier?
What is typedf?