View Code of Problem 66

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

Double click to view unformatted code.


Back to problem 66