View Code of Problem 66

# include<stdio.h>
gys(int i,int j)
{
    int t,max;
    for(t=1;t<=i;++t)
    {
        if(i%t==0&&j%t==0)
        {
            max = t;
        }
    }
    return max;
}
int main(void)
{
  int a,b,t;
  while(scanf("%d %d",&a,&b)!=EOF)
  {
    if(a!=b)
    {
    t = gys(a,b);
    printf("%d/%d\n",a/t,b/t);
    }
    else
      printf("1\n");
  }
  return 0;
}

Double click to view unformatted code.


Back to problem 66