PROGRAM TO FIND PRIME NUMBER – JAVA

//PROGRAM TO FIND PRIME NUMBER
class Prime
{
public static void main(String arg[])
{
int n=4,f=0;
for(int i=2;i<=n/2;i++)
{
if(n%i==0)
{
System.out.println(“The number is not prime”);
f=1;
break;
}
}
if(f==0){System.out.println(“the number is prime”);}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *