Created
January 4, 2022 20:36
-
-
Save ayeshLK/1aa46586a0e3b62311beb3ce625c998c to your computer and use it in GitHub Desktop.
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
function leastCommonMultiple(int a, int b) returns int { | |
int counter = 1; | |
while true { | |
counter += 1; | |
// if the `counter` is divisible by `a` and `b` break the loop | |
if counter % a == 0 && counter % b == 0 { | |
break; | |
} | |
} | |
return counter; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment