This commit is contained in:
2026-04-29 19:42:37 -06:00
parent 7387fba90f
commit 0d5511b4eb

View File

@@ -161,10 +161,10 @@ impl ops::Neg for Fraction {
impl fmt::Display for Fraction { impl fmt::Display for Fraction {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.num > 1 { if self.num == 1 {
return write!(f, "{0}/{1}", self.num, self.den);
} else {
return write!(f, "{0}", self.num); return write!(f, "{0}", self.num);
} else {
return write!(f, "{0}/{1}", self.num, self.den);
} }
} }
} }