You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
332 B
34 lines
332 B
1 year ago
|
int n;
|
||
|
|
||
|
int gcd(int m,int n)
|
||
|
{
|
||
|
int t;
|
||
|
int r;
|
||
|
|
||
|
if(m<n) { t=m;m=n;n=t; }
|
||
|
|
||
|
r=m%n;
|
||
|
|
||
|
while(r!=0)
|
||
|
{
|
||
|
m=n;
|
||
|
n=r;
|
||
|
r=m%n;
|
||
|
}
|
||
|
|
||
|
return n;
|
||
|
|
||
|
}
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
//newline=10;
|
||
|
int i;
|
||
|
int m;
|
||
|
//m = 1478;
|
||
|
//int t;
|
||
|
i=getint();
|
||
|
m=getint();
|
||
|
|
||
|
return gcd(i,m);
|
||
|
}
|