各位大佬这个题怎么做

解决方案 »

  1.   

    思路都写了。for循环。
      

  2.   

    这个就贼难那我岂不是要上天https://blog.csdn.net/mr_zql/article/details/92264836第2和第3题你自己看看有没有帮助
      

  3.   

    class Test {    public static void main(String[] arges) throws Exception {
          while (true){
            Scanner scanner = new Scanner(System.in);
            int a = scanner.nextInt();
            boolean flag =true;
         for (int i = 2; i<a-1;i++){
            if (a%i==0){
                flag = false;
                continue;
            }
         }
         if (flag){
             System.out.println("该数字是质数");
         }else {
            System.out.println("该数字不是质数");}        }
        }
    }