1 Commits
Author SHA1 Message Date
Z.Gharagozloo.M d04f6c9608 The rational class updated. 2026-05-15 15:44:23 +03:30
+7 -1
View File
@@ -82,7 +82,13 @@ public class Rational {
} }
//TODO //TODO
public static Rational divide(Rational r1, Rational r2) {return r1.divide(r2);} public static Rational divide(Rational r1, Rational r2) {
if (r2.numerator == 0) {
System.out.println("You can't divide a number by zero!");
return null;
}
return r1.divide(r2);
}
// PROVIDED - String representation // PROVIDED - String representation
@Override @Override