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