View Code of Problem 66

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

Double click to view unformatted code.


Back to problem 66