#include /* */ /* main program for euclid.c */ /* given a, b, returns x, y, m such that */ /* a * x + b * y = m = gcd(a, b) */ /* */ main() { int a, b, m, x, y; int euclid(); while ( 1 == 1) { printf("\n"); printf("Euclidean algorithm\n"); printf("Given a, b, returns x, y, m such that a*x + b*y = g = gcd(a,b)\n"); printf("Enter a, b:\n"); scanf("%d %d", &a, &b); euclid(a, b, &x, &y, &m); printf("x, y, and m are %d %d %d\n", x, y, m); printf("\t%d * %d + %d * %d = %d\n",a,x,b,y,m); } }