package pureTest;
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class test3 {
public static void main(String[] args) {
/* Enter your code here. */
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 2; i< n; i++){
if( n <= 3){
System.out.println("Prime");
break;
}else if( n%i ==0){
System.out.println("Not Prime");
break;
}else{
System.out.println("Prime");
}
}
}
}
the input of 7; the out put is repetitions of Prime:
7
Prime
Prime
Prime
Prime
Prime
Just wondering why the if condition doesn't work out here.
Aucun commentaire:
Enregistrer un commentaire