Question: P2 (30 points) - Array Step 1 (5 points): Write a function isPrime() that gets an integer number and returns true if the number is
P2 (30 points) - Array
Step 1 (5 points): Write a function isPrime() that gets an integer number and returns true if the number is prime and returns false if the number is not prime.
Hint: A number is prime if it is divisible by only 1 and itself.
Step 2 (15 points): Write a function that gets an array and counts and returns the number of elements of the array that are prime (using the function in step 1).
Step 3(10 points): In your main(), create an array of size 100 and initialize it with the first 100 odd numbers, starting 1 (that is 1, 3, 5, ...). Use the function in step 2 to count the number of prime numbers in the array.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
