用java编写一个程序验证哥德巴赫猜想
关注:126 答案:2 mip版
解决时间 2021-02-06 05:41
提问者时光盗走我的心
2021-02-05 22:51
完善一下代码
●程序
public class Guess {
public static void main(String[] args) {
System.out.println("在1~100范围内,现在开始证实哥德巴赫猜想:");
if (Testify_Guess(1, 100)) {
System.out.println("在 1~100范围内,哥德巴赫猜想是正确的。");
} else {
System.out.println("哥德巴赫猜想是错误的");
}
}
public static boolean Testify_Guess(int low, int high) {
// 判断1~100范围内的所有偶数是否符合哥德巴赫猜想,符合则返回true,反之则返回false
boolean flag = true;
int j = 0;
for (int i = low; i <= high; i&#