Reduce fractions by smkt

#include<iostream>
#include<cstdlib>
using namespace std;main(){int a,b,c;char d[9];while(!cin.eof()){cin.getline(d,9,47);a=atoi(d);cin.getline(d,9);
b=atoi(d);for(c=99;--c>1;)while(!(a%c)&!(b%c))a/=c,b/=c;cout<<a<<'/'<<b<<"\n";}}

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

download

return to the top page