Description
Compute the greatest common divisor between two positive integers.
Input
Two positive integer n (1 <= n <= 10000) and m (1 <= m <= 10000)
Output
The greatest common divisor between n and m.
Sample Input
35 28
Sample Output
7
Hint
The output is only one line.
// Date:2020/3/28
// Author:xiezhg5
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
int a,b,c,d,temp;
scanf("%d %d",&a,&b);
c=a*b;
if(a<b)
{
temp=a;
a=b;
b=temp;
}
d=b;
while(d!=0)
{
d=a%b;
a=b;
b=d;
}
printf("%d\n",a);
return 0;
}