#7793: (Java) WA為什麼~~~ 幫幫我


smllai (Jane)


import java.util.Scanner;

public class a007 {
    public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();

for (int i = 2;i<=Math.sqrt(a) ;i++ )
{
while(a%i==0)
{
System.out.println("非質數");
System.exit(0);
}

}
System.out.println("質數");

}
}
 
 
程式沒有逾時,在本機跑也都很正常,麻煩大大 謝謝