#include
char IsSimple( int num )
{
int i;
if (num < 2 && num > -2)
return 0;
for (i = 2; i < num / 2 + 1; i++)
{
if (num % i == 0)
return 0;
}
return 1;
}
void main( void )
{
int i;
int
*mainArray,
numOfEl,
numOfPrimeNum = 0;
printf("Input a number of the elements in the sequence: ");
scanf("%i", &numOfEl);
mainArray = (int *)malloc(sizeof(int) * numOfEl);
for (i = 0; i < numOfEl; i++)
{
scanf("%i", &mainArray[i]);
if (IsSimple(mainArray[i]))
numOfPrimeNum++;
}
printf("Number of the prime numbers is %i\n", numOfPrimeNum);
system("pause");
} /* End of the 'main' function */