import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int start = scanner.nextInt(); int end = scanner.nextInt(); method(start,end); } public static void method(int start, int end) { int count=0; if(start>end) { int temp=start; start=end; end=temp; } //write your code here...... for(int i=start;i<=end;i++) { if(i>2&&fun(i)) { count++; } } System.out.println(start+"到"+end+"之间有"+count+"个大于2的素数"); } public static boolean fun(int num) { for(int i=2;i<=Math.sqrt(num);i++) { if(num%i==0) { return false; } } return true; } }