class Prime {
public static void main(String[] args) {
int number = 11;
int i;
for (i=2; i < num ;i++ ){
int n = number%i;
if (n==0){
System.out.println("number is not Prime!");
break;
}
}
if(i == num){
System.out.println("number is Prime !");
}
}
}
Good Example
ReplyDelete