write a program to generate 1st n fibonacci prime number

Answer Posted / swapna

#include <stdio.h>
#include <conio.h>
void main ( )
{
long a,b,c,i,n,j;
clrscr( );
printf ("\n Enter the number to print fibnocci
prime number\t");
scanf ("%ld",&n);
a=0;
b=1;
for (i=1; i<n; i++)
{
c=a+b;
a=b;
b=c;
printf ("\n fibnoci series is %ld\t",c);
for(j=2;j<c;j++)
{
if(c%j==0)
break;
}
if(c==j)
printf(" prime number is %ld\t",c);
}
getch();
}

Is This Answer Correct ?    89 Yes 39 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sizeof return in c?

610


What is the difference between exit() and _exit() function in c?

578


How do you redirect a standard stream?

618


What is the advantage of an array over individual variables?

728


What is bubble sort technique in c?

583






How macro execution is faster than function ?

660


What are the advantages of using new operator as compared to the function malloc ()?

752


Why do we use static in c?

627


What is dynamic dispatch in c++?

552


What is difference between structure and union in c programming?

565


What is boolean in c?

603


What are the advantages of c preprocessor?

706


Can you subtract pointers from each other? Why would you?

556


How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?

608


Is linux written in c?

594