package com.yingyong.day07;
public class GongYueShu {
public static void main(String[] args) {
// TODO Auto-generated method stub
int m,n,r;
m = 76;
n = 22;
r = m & n;
while(r!=0) {
m = n;
n = r;
r = m % n;ide
} System.out.println("最大公約數爲:" + n);
}}
結果:
最大公約數爲:2code