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
How can I prevent another program from modifying part of a file that I am modifying?
In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.
What is nested structure with example?
Write a function that will take in a phone number and output all possible alphabetical combinations
What is an example of structure?
Linked lists -- can you tell me how to check whether a linked list is circular?
Explain what is wrong with this statement? Myname = ?robin?;
What is assert and when would I use it?
Write a program to swap two numbers without using a temporary variable?
Can we declare a function inside a function in c?
What are local static variables?
Write a program to reverse a given number in c language?
Why does everyone say not to use gets?
What is I ++ in c programming?
What are the uses of a pointer?