Created
February 4, 2024 15:58
-
-
Save halka9000stg/65277559567ff25216f2da855465ffd6 to your computer and use it in GitHub Desktop.
Demo for LCM Simple Implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(){ | |
print((5).lcm(2)); | |
print((4).lcm(3)); | |
} | |
extension LCM on int { | |
int lcm(int other) => (this * other) ~/ this.gcd(other); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment