#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[])
{
int num1,num2;
int i;
scanf("%d %d",&num1,&num2);
int hcf=1;
int min=num1;// 2 1
if(num1>num2)
min=num2;
for(i=1;i<=min;i++)
{
if(num1%i==0 && num2%i==0)
{
hcf=i;
}
}
printf("%d",hcf);
return 0;
}
沒有留言:
張貼留言