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 is the difference between arrays and pointers?
What is operator precedence?
What is pass by value in c?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
Is there sort function in c?
What does a function declared as pascal do differently?
How many main () function we can have in a project?
What is the equivalent code of the following statement in WHILE LOOP format?
Explain the use of #pragma exit?
Explain how can I convert a number to a string?
Why & is used in scanf in c?
What is the difference between #include
Does * p ++ increment p or what it points to?
What are pragmas and what are they good for?