View Code of Problem 66

#include<stdio.h>
int main(){
	int a,b; 
	while(scanf("%d %d",&a,&b)!=EOF){
		//找出最大公约数 
		//这里使用辗转消除法 
		int c,d;
		c=a;
		d=b;
		int t;
		if(a==b){
			printf("1\n");
		
		}else{
			
		
		while(b!=0){
			t=a%b;
			a=b;
			b=t;
		} //这里a就是最大公倍数 
		
		printf("%d/%d\n",c/a,d/a);
		}
		//printf("%d\n",a);
		
	}
	
	return 0;
}

Double click to view unformatted code.


Back to problem 66