View Code of Problem 66

#include<stdio.h>
#include<string.h>
#include<math.h>
int y(int i,int j)
{
	int temp,n;
	if(i<j)
	{
		temp=i;
		i=j;
		j=temp;
	}
	 n=i%j;
	 while(n!=0)
	 {
	 	i=j;
	 	j=n;
	 	n=i%j;
	 }
	 return j;
}
int main()
{
	int n,k,l,i;
	int temp;
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF)
	{
		temp=y(a,b);
		printf("%d/%d\n",a/temp,b/temp);
}
}

Double click to view unformatted code.


Back to problem 66