#include
int main()
{
int a,b,r,x,y;
do
scanf("%d",&a);
while (a<=0);
do
scanf("%d",&b);
while (b<=0);
if (a>b)
{
x=b;
r=a%b;
}
else
{
x=a;
r=b%a;
}
while(r!=0)
{
y=x;
x=r;
r=y%x;
}
printf("%d",x);
0を返します。
}
int PGCD(int a, int b)
{
if(a==b)
{
return a;
}
else
{
if(a>(b)
return PGCD(a-b, b);
else
return PGCD(a, b-a);
}
}
Please disable your ad blocker and refresh the window to use this website.