I have to right a program that tests the nth fibonacci number and then test for primeness. It must output the first five prime numbers in the fibonacci seequence. Using two functions.
i know how to test for primeness and the fibonnacci number i just dont know how to incorpoate the two and output only 5 numbers
You use a counter that stops after you calculate the first 5 prime Fibonacci numbers.
1 2 3 4 5 6 7 8
while(counter_fib!=5)
{
if(prime(Fibbonaci(number))) //see if the current Fibonacci number is prime
++counter_fib; //increase counter;
++number; // go to the next number
}