#include int pgcd(int a, int b) { int c; if (a > b) { c = a; a = b; b = c; } while (a != 0) { c = a; a = b % a; b = c; } return b; } int main(int argc, char *argv[]) { int a, b; if (argc != 3 || sscanf(argv[1], "%d", &a) != 1 || sscanf(argv[2], "%d", &b) != 1) return -1; printf("%d\n", pgcd(a, b)); return 0; }