View Code of Problem 66

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

Double click to view unformatted code.


Back to problem 66