JirR02 b9d258de44 Exercise 2
Added Exercise 2 to repository
2025-03-01 13:38:33 +01:00
..
2025-03-01 13:38:33 +01:00
2025-03-01 13:38:33 +01:00

Task

Fibonacci numbers are the integers in the following sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, .... Each number is the sum of the two previous numbers.

Fibonacci primes are Fibonacci numbers that are also prime numbers. Write a program that asks the user for an integer m and then computes and prints all Fibonacci primes between 0 and m (including). Print each number on a new line.

Finally, on a new line print the total number of Fibonacci primes found.

Example

If your program is asked to print the Fibonacci primes between 0 and 14 the output should look something like this:

2
3
5
13
Found 4 Fibonacci primes

Important: using anything other than int (e.g., unsigned int, floating point numbers, long, or double long) is forbidden.