write a program to generate 1st n fibonacci prime number
Answer Posted / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int n,a=1,b,c=0,d=0,i,j;
printf("\nenter the number ");
scanf("%d",&n);
printf("\nThe fibbonacci prime numbers are ");
for(i=0;i<=n-1;i++)
{
b=c+a;
a=c;
c=b;
j=2;
while(j<=b-1)
{
if(b%j==0)
{
break;
}
j++;
}
if(j==b)
{
printf("\n%d",b);
}
}
getch();
}
| Is This Answer Correct ? | 16 Yes | 6 No |
Post New Answer View All Answers
What is the difference between abs() and fabs() functions?
Why c is a procedural language?
Why is c used in embedded systems?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
How can I insert or delete a line (or record) in the middle of a file?
What are header files why are they important?
Explain the properties of union. What is the size of a union variable
What is a ternary operator in c?
Find MAXIMUM of three distinct integers using a single C statement
What are different types of pointers?
How can you determine the size of an allocated portion of memory?
How can you allocate arrays or structures bigger than 64K?
How can you access memory located at a certain address?
which is conditional construct a) if statement b) switch statement c) while/for d) goto
How can I recover the file name given an open stream?