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
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?
What is 1f in c?
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
Difference between linking and loading?
Explain how do you determine whether to use a stream function or a low-level function?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
Are there namespaces in c?
What is main () in c language?
Do pointers take up memory?
What is #line?
write a c program for swapping two strings using pointer
What is the method to save data in stack data structure type?
Is there sort function in c?
Explain what is the benefit of using #define to declare a constant?