最大公约数

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);
    }

}

 

posted @ 2016-07-30 19:41  me丶不是好人  阅读(71)  评论(0编辑  收藏  举报