public class Test_Ngto{
public static void main(String args[]){
InputStream is = System.in;
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
try{
String n = br.readLine();
long l = Long.valueOf(n).longValue();
long range = (long)Math.sqrt(l);
int ok = 1;
for(int i=2;i<=range;i++){
if(l % i == 0) ok = 0; break;
}
if(ok == 1){
System.out.println("So nay la nguyen to");
}
else{
System.out.println("So nay khong la nguyen to");
}
}
catch(IOException ie){
System.out.print("Error: " +ie);
}
}
}
Klik untuk melihat kode: :) =( :s :D :-D ^:D ^o^ 7:( :Q :p T_T @@, :-a :W *fck* x@