first write a program to catch all the prime numbers in to an array in a given or a chosen range....
and compare the elements of prime numbers with the each element of the array u want...
if one of ur array element is equal to a element of prime number array,,that means it's a prime number....
e.g.
A[4]={1,5,3,4,17}; //range is 1 to 20
primArray[10]={2,3,5,7,11,13,17,19}
now compare array 'A' with the each element of 'primArray'.
if u find hard to write a program to catch prime numbers of a given range to an array email me....
A prime number is a number that can only be evenly divided by itself and 1. Let number x equal a given element in the array. Now you can for loop from 2 to x-1 and use the modulus operator. If the resulting value is equal to 0 then it is certainly not a prime.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.