View Code of Problem 66

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

Double click to view unformatted code.


Back to problem 66