Question: (Use C++ please) Write a function countPrimes that takes in two parameters: an int array and the size of the array. The function returns the
(Use C++ please) Write a function countPrimes that takes in two parameters: an int array and the size of the array. The function returns the count of the number of prime elements in the array. int countPrimes(int array[], int size) Given array: {1, 2, 3, 4, 5, 7, 10, 12} Expected return: 4 Explanation: The primes are 2, 3, 5, and 7; consequently, the function returns a count of 4. Hint: Create a function IsPrime to call from within your countPrimes function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
