#include<iostream> using namespace std; int main() { int a,b,c,i,j; while( cin>>a>>b ) { if( a==b && a==1 ) { 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.