#include<stdio.h>
int main()
{
int a,b,n;
scanf("%d%d", &a, &b);
while(a%b !=0)
{
n = a%b;
a = b;
b = n;
}
printf("%d",b);
return 0;
}
#include
int main()
{
int a,b,n;
scanf("%d%d", &a, &b);
while(a%b !=0)
{
n = a%b;
a = b;
b = n;
}
printf("%d",b);
return 0;
}
輸入要用迴圈