#include <stdio.h> int gygb(int m,int n,int x) { int a; if(x==0) { for(a=m;a>=1;a--) if(m%a==0 && n%a==0) return a; return a; } else { for(a=m;a<m*n;a++) if(a%m==0 && a%n==0) return a; return a; } } main() { printf("%d",gygb(3,5,1)); printf("%d",gygb(3,5,0)); getchar(); }
标签:return,公倍数,整数,C语言,int,最大公约数 From: https://www.cnblogs.com/xkdn/p/16974379.html