View Code of Problem 66

#include<iostream>
using namespace std;
int main()
{
    long long a,b,c,i,j;
    while( cin>>a>>b )
    {
        if( a==b )
        {
            cout<<1<<endl;
            break;
        }
        int t1=a,t2=b;
        while( b!=0 )
        {
            c=a%b;
            a=b;
            b=c;
        }
        cout<<t1/a<<"/"<<t2/a<<endl;
    }
}

Double click to view unformatted code.


Back to problem 66