View Code of Problem 66

#include<stdio.h>
int fun(int a,int b){
	int c;
	while(b!=0){
		c=a%b;
		a=b;
		b=c;
	}
	return a;
}
int main(){
	int a,b,c;
	while(scanf("%d%d",&a,&b)!=EOF){
		if(a==b){
			printf("1\n");
		}else{
			c=fun(a,b);
			printf("%d/%d\n",a/c,b/c);
			
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 66