解题思路: 遍历大于二的整数满足条件则输出
注意事项: 变量的有效范围!!(被困二十分钟)
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
boolean go = true;
while(go){
int x=0;
for(int i=2;i>0;i++){
int a0=a%i;
int b0=b%i;
int c0=c%i;
x = i;
if(a0==b0&&b0==c0){
go = false;
break;
}
else{
continue;
}
}
System.out.println(x);
}
}
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.7 (C语言代码)浏览:767 |
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:724 |
校门外的树 (C语言代码)浏览:1130 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:694 |
震宇大神的杀毒软件 (C++代码)浏览:1125 |
C语言训练-角谷猜想 (C语言代码)浏览:1724 |
【数组的距离】 (C语言代码)浏览:751 |
十->二进制转换 (C语言代码)浏览:1299 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:460 |
众数问题 (C语言代码)浏览:845 |