Question: Problem 2 Assume you are given two functions: a function bool isPrime(int n) that checks if a number is prime or not (assume the function

Problem 2

Assume you are given two functions: a function bool isPrime(int n) that checks if a number is prime or not (assume the function is in a library, therefore you dont need to implement it, just use it), and another function int Fib(int n) that returns the nth Fibonacci number (for instance: the fourth Fibonacci number is Fib(4) = 5).

1. Write a function that accepts an array of integers and its size and returns the number of values in the array that are both prime and a Fibonacci number. In the example above, 5 is one those values (it is prime and it is a Fibonacci number). Please provide explanation of your code.

2. Write a main function where you make a call to the above function with appropriate parameters of your choice. (Allow for use input) Please provide explanation of your code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!