import java.io.*;
class Prime
{
public static void main(String[] arg)
throws IOException
{
int i=2;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter the first number");
int n=Integer.parseInt(br.readLine());
for(i=2;i<=n/2;i++)
{
if(n%i==0)
break;
}
if(i==((n/2)+1))
System.out.println("prime");
else
System.out.println("not prime");
}
}


No comments:
Post a Comment