编辑代码

class Main {
	public static void main(String[] args) {
        //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
		System.out.println("Hello JSRUN!   \n\n         - from JAVA .");
        	Scanner sc = new Scanner(System.in);
		System.out.println("请输入两个整数:");
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c ;
		if(a>b)
			c=b;
		else{
			c=a;
		}
		while (c>=1){
			if( a%c==0 && b%c==0)
			   break;
		c--; 
		}
		System.out.println("最大公约数:"+c);
	}
}