View Code of Problem 66

#include <stdio.h>
int main(){
	int a,b,i,max,temp,min;
	while(scanf("%d %d",&a,&b)!=EOF){
		if(a==b){
			printf("1\n");
		}
		else{
			if(a>b){
				temp=a;
				a=b;
				b=temp;
			}
			for(i=b;i<=a*b;i++){
				if(i%a==0&&i%b==0){
					min=i;	
				}
			}
			max=a*b/min;
			printf("%d/%d\n",a/max,b/max);	 
		}	
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 66