class Prime{
public static void main(String args[])
{
int num=Integer.parseInt(args[0]),c=0;
for(int i=2;i<=num/2;i++)
if(num%i==0)
c++;
if(c==0)
System.out.println(num+" is a prime number.");
else
System.out.println(num+" is not a prime number.");
}
}
public static void main(String args[])
{
int num=Integer.parseInt(args[0]),c=0;
for(int i=2;i<=num/2;i++)
if(num%i==0)
c++;
if(c==0)
System.out.println(num+" is a prime number.");
else
System.out.println(num+" is not a prime number.");
}
}
No comments:
Post a Comment