prime in java


to calculate whether the number is prime or not.prime in java
javalearing.blogspot.com
itprofessionalsrocks.blogspot.com
class prime
{
public static void main(String args[])
{


int num=11;
int i;
for( i=2;i<num;i++)
{
int n=num%i;
if(n==0)
{
System.out.println("not prime");
break;
}
}
if(i==num){
System.out.println("prime number");
}
 }   }

Comments