#include<stdio.h> main() { int a,b,i,temp=0,a1,b1; while(scanf("%d %d",&a,&b)!=EOF) { if(a==b)printf("1\n"); else { for(i=1;i<=a;i++) { if(a%i==0&&b%i==0) temp=i; } a1=a/temp; b1=b/temp; printf("%d/%d\n",a1,b1); } } } |
Double click to view unformatted code.