### Please Need Help in Assignment As soon As possible

Write a program that counts number of prime numbers in an Array. The program must be able to use functions, in particular, The program must use the count as reference variable in main.
A starting point
 ``123456789101112131415161718192021`` ``````#include bool is_prime(int num) { // your code here } void count_primes(int numbers[], int size, int count) { // your code here } int main() { int numbers[] = { 11, 13, 15, 17, 19, 21, 23, 25, 27, 29}; int count = 0; count_primes(numbers, 10, count); std::cout << "The array contains " << count << "prime numbers"; }``````

Now it's your turn to write the code to check if a number is prime and call this from count_primes in a loop for each number in the array.
Thankyou Soo Much Bro Can You Teach Me A Bit ?
This is not a homework site. Show us what you have so far, and ask good questions about what you don't understand.

If your code fails to compile, tell us that and give us the compiler error messages.

If your code compiles but does not do what it is supposed to do, tell us what it does vs. what it's supposed to do.

We don't generally respond to veiled (or even not so veiled) requests to do your homework for you.

I thought @Thomas1965's code snippet was a good starting point for you (although there is an error in it--you'll have to discover it before you can ask questions about it). My recommendation for you, however, is to not worry about count_primes until you get is_prime working first. Test is_prime on a series of numbers and make sure it works before worrying about dealing with an array.

Get out there and try stuff and see what it does. When it doesn't work, ask us a question.
you can use for loops and % operator to check it is prime number or not
Last edited on
To judge a number n whether is prime, you should test from 2 to floor(sqrt(n)) to see if there is any factor in the list.