Hi
check this code, you did some syntax error, take care.
class branch
{
public static void main(String[] args)
{
int[] a={12,34,35,42,9,76,31,54,99,150};
int i;
boolean gotit=false;
for(i=0;i<a.length;i++)
{
for(int j=2;j<a[i];j++)
{
if(a[i]%j!=0)
{
gotit=true;
break;
}
}
}
if(gotit)
{
System.out.println("found the prime in given array");
}
else
{
System.out.println("no number is prime in given array");
}
}
}
java teacher
Dec 24, 2010