辗转相除法java实现

 
	/*
	 * 最大公约数
	 */
	public static int GCD(int a,int b){
		int c=a%b;
		if (c==0) {         //如果c=0,直接返回较小的值b
			return b;
		}else{              
			return GCD(b,c);
		}
	}

 

发布了31 篇原创文章 · 获赞 1 · 访问量 1240

猜你喜欢

转载自blog.csdn.net/qq_45824565/article/details/104829109