fix
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user