c语言学习路程——最大公约数
1 #include <stdio.h> 2 3 4 int main() { 5 6 int a = 0; 7 int b = 0; 8 int count=0; 9 scanf_s("%d", &a); 10 scanf_s("%d", &b); 11 while (b != 0) { 12 int c = a % b; 13 a = b; 14 b = c; 15 count++; 16 } 17 18 printf("a-b的最大公约数=%d\n", a); 19 printf("count=%d\n", count); 20 21 return 0; 22 }