Monday, July 27, 2009

How do I fix my program, to return number of primes in array?

class ReturnNumberOfPrimes


{


public static void main (String args [])


{


int c[ ]={12,13,7, 2, 5};


int a=ReturnNumberOfPrimes(c);


System.out.print(a);


}





public static int ReturnNumberOfPrimes (int list [ ])


{


for (int i=0; i%26lt;list.length; i++)


{


if(list[i]%2!=0 %26amp;%26amp; list[i]%3!=0)


}


return i;


}

How do I fix my program, to return number of primes in array?
Use the pseudocode in the following web site for the inside of your 'for loop':


No comments:

Post a Comment