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 will be your course of action for a push operation?
Is c++ based on c?
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
Write a program to generate random numbers in c?
What are the various types of control structures in programming?
Can we assign string to char pointer?
Why clrscr is used in c?
How can variables be characterized?
Are there namespaces in c?
How can my program discover the complete pathname to the executable from which it was invoked?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
Is array a primitive data type in c?
Can we access the array using a pointer in c language?
program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)
What is a stream in c programming?