import java.io.* public class PrimeNo { public static void main(String args[]) { Console con = System.console(); int num = Integer.parseInt(con.readLine()); for(int i=2;i<=num/2;i++) { temp=num%i; if(temp==0) { isPrime=false; break; } } //If isPrime is true then the number is prime else not if(isPrime) System.out.println(num + " is Prime Number"); else System.out.println(num + " is not Prime Number"); } }
Comments
Post a Comment