1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| #include <stdio.h> #include <stdlib.h> int main() { int a =0; int b =0; int temp; scanf("%d,%d",&a,&b); printf("%d,%d\n", a, b);
if (a < b) { temp = a; a = b; b = temp; } while (0 != a%b) { temp = a%b; a = b; b = temp; printf("a=%d b=%d\n", a, b); } printf("%d\n", b); system("pause"); return 0; }
|