import java.util.Scanner;
public class Prime {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int x, y =2;
String value;
System.out.print("Enter A Number: ");
x = s.nextInt();
while (x != 0){
if (y<x){
if(x%y==0){
value= "Is Not A Prime";
System.out.print(value);
break;}
else{
y++;
continue;}
}
else{
value = "Is A Prime";
System.out.print(value);
break;}
}
}
}
No comments:
Post a Comment