#include <stdio.h> int main() { int n, m,c; scanf("%d%d", &m, &n); c=n; while (m %n!=0) { c = m % n; m= n; n = c;//辗转相除法 } printf("%d", c); return 0; }
#include <stdio.h> int main() { int n, m,c; scanf("%d%d", &m, &n); c=n; while (m %n!=0) { c = m % n; m= n; n = c;//辗转相除法 } printf("%d", c); return 0; }