View Code of Problem 66

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

Double click to view unformatted code.


Back to problem 66