输入一个数找大于它最小质数!!!
import java.util.Scanner; public class Text2 { public static void main(String[] args) { Scanner x = new Scanner(System.in); int a = x.nextInt(); a+=1; int result = Text2.suShuPanDuan(a); System.out.println(result); } static int suShuPanDuan(int a) { int i; for (i = 2; i <= a / 2; i++) { if (a % i == 0) { a++; } } return a; } }