package com.example.demo.contorller; public class test2 { public static void main(String[] args) { boolean flag=false; for (int i=101;i<=200;i++){ for (int j=2;j<=Math.sqrt(i);j++){ if (i%j==0){ flag=true; break; } } if (flag==true){ System.out.println(i); flag=false; } } } }
素数相反就可以