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