View Code of Problem 66

//66题 
#include<stdio.h>
int f(int i,int j)
{
	int t=0,max=1;
	for(t=1;t<=i;t++)
	{
		if(i%t==0&&j%t==0)
			max=t;
	}
	return max;
}

int main()
{
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		if(a==b)
			printf("1\n");
		else
			printf("%d/%d\n",a/f(a,b),b/f(a,b));
		
	}
	
	
	return 0;
}

Double click to view unformatted code.


Back to problem 66