import java.util.Scanner;
public class sushu {
private boolean isPrime(int n){
int i=0;
while(true){
if(i==2)break;
for(int t=1;t<n;t++){
if(n%t==0){
i++;
}
}
}
return true;
}
public void main(String[] agrs){
System.out.println("To determine whether primes");
System.out.println("Please enter the number :");
Scanner in=new Scanner(System.in);
int n=in.nextInt();
if(isPrime(n)){
System.out.println("The number is primes");
}
}
}
import java.util.Scanner;
public class sushu {
private static boolean isPrime(int n) {
int i = 0;
while (true) {
if (i == 2)
break;
for (int t = 1; t < n; t++) {
if (n % t == 0) {
i++;
}
}
}
return true;
}
public static void main(String[] agrs) {
System.out.println("To determine whether primes");
System.out.println("Please enter the number :");
Scanner in = new Scanner(System.in);
int n = in.nextInt();
if (isPrime(n)) {
System.out.println("The number is primes");
}
}
}
main函數有問題 static