#include "stdio.h" #include "math.h" #include "string.h" void main() { int a,b; int x,y; int r; for(;scanf("%d%d",&a,&b)!=EOF;) { if(a==b) printf("1\n"); else { x=a; y=b; r=a%b; for(;r!=0;) { a=b; b=r; r=a%b; } printf("%d/%d\n",x/b,y/b); } } } |
Double click to view unformatted code.