Reduce fractions FIXED by jamesaxl

sub g{\x0d
$a=shift;\x0d
$b=shift;\x0d
while ($a!=0){\x0d
$c = $a; $a = $b%$a;  $b = $c;}\x0d
return $b;\x0d
}\x0d
while(<STDIN>){\x0d
@a=split(/\//);\x0d
$c=g($a[0],$a[1]);\x0d
print $a[0]/$c."/".$a[1]/$c."\n";\x0d
}

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

download

return to the top page