CODING:
class prime
{
public static void main(String[] args)
{
int[] num={5,13,24,18,9,7,33,10,56,23};
int k,i,flag=0;
for(k=0;k<10;k++)
{
for(i=2;i<=num[k]/2;i++)
{
if(num[k]%i==0)
{
flag=1;
break;
}
}
if(flag==0)
System.out.print(num[k] + " ");
flag=0;
}
}
}
{
public static void main(String[] args)
{
int[] num={5,13,24,18,9,7,33,10,56,23};
int k,i,flag=0;
for(k=0;k<10;k++)
{
for(i=2;i<=num[k]/2;i++)
{
if(num[k]%i==0)
{
flag=1;
break;
}
}
if(flag==0)
System.out.print(num[k] + " ");
flag=0;
}
}
}
Comments
Post a Comment