View Code of Problem 66

#include<stdio.h>
#include<string.h>

int main()
{
	 int a,b,c,temp,x,y;
	 while(scanf("%d %d",&a,&b)!=EOF)
	 {
		  if(a==b)
		  {
			  printf("1\n");
		  }
		  else
		  {
			  x=a;
			  y=b;
              while(x!=0)
			  {
				  temp=y%x;
				  y=x;
				  x=temp;
			  }
			  a=a/y;
			  b=b/y;
			  printf("%d/%d\n",a,b);

		  }
	 }

}

Double click to view unformatted code.


Back to problem 66