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