예제 #1
0
 public void mul(Fraction f) {
   this.a = this.a * f.a;
   this.b = this.b * f.b;
   int gcd = Tool.gcd(this.a, this.b);
   this.a = this.a / gcd;
   this.b = this.b / gcd;
 }
예제 #2
0
 public void div(Fraction f) {
   int tmp_a = this.a;
   int tmp_b = this.b;
   this.a = tmp_a * f.b;
   this.b = tmp_b * f.a;
   // System.out.println(this);
   int gcd = Tool.gcd(this.a, this.b);
   this.a = this.a / gcd;
   this.b = this.b / gcd;
 }