View Code of Problem 66

#include<iostream>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int k;
		for(int i=a;i>0;i--){
			if(a%i==0&&b%i==0){
				k=i;
				break;
			}
		}
		a=a/k;
		b=b/k;
		cout<<a<<"/"<<b<<endl;
		
	} 
	return 0;
}

Double click to view unformatted code.


Back to problem 66