最大公约数
package card; import java.util.Scanner; public class Anli8 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); System.out.println("请输入两个整数"); int m = input.nextInt(); int n = input.nextInt(); int r; do{ r = m % n; m = n; n = r; } while(r != 0); System.out.println(m); } }