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
Why c is called a mid level programming language?
Why does the call char scanf work?
What is c language used for?
What are loops in c?
How is null defined in c?
how should functions be apportioned among source files?
What are the types of data structures in c?
What are the header files used in c language?
What is NULL pointer?
What are examples of structures?
What is dangling pointer in c?
Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.
If null and 0 are equivalent as null pointer constants, which should I use?
Explain the advantages and disadvantages of macros.
What library is sizeof in c?