View Code of Problem 66

#include "stdio.h"
void main()
{	
	int r;
	int a,b;
	int ax,bx;
	for(;scanf("%d%d",&a,&b)!=EOF;)
	{
		ax=a;
		bx=b;
		r=b%a;
		for(;r!=0;)
		{
			b=a;
			a=r;
			r=b%a;
		}
		if(ax/a==1&&bx/a==1)
			printf("1\n");
		else
			printf("%d/%d\n",ax/a,bx/a);
	}
}

Double click to view unformatted code.


Back to problem 66