Reduce fractions by jamesaxl

int g ( int a, int b )\x0d
{\x0d
  int c;\x0d
  while ( a != 0 ) {\x0d
     c = a; a = b%a;  b = c;\x0d
  }\x0d
  return b;\x0d
}\x0d
int main(void)\x0d
{\x0d
char l[10];char *p;int c;\x0d
while(gets(l)){\x0d
strtok_r (l,"/",&p);\x0d
c=g(atoi(l),atoi(p));\x0d
printf("%d/%d\n",atoi(l)/c, atoi(p)/c);\x0d
}\x0d
}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page