package com.ttttttt; /** * m,n为两个数,gcd方法为求最大公因数 */ public class Gcd { public static long gcd(int m, int n){ while (n!=0){ int rem=m%n; m=n; n=rem; } return m; } public static void main(String[] args) { System.out.println(gcd(50, 100)); } }
50