Dear Team,
I want to find LCM, I try but got error.please help
Hello Tuto
Is your code result wrong or does it trigger an error message? If there is an error message, we need to see it.
Lowest Common Multiple. It looks like you are trying to find the LCM of two numbers - but are those numbers Integers or floats?
Here is a very simple method, limited to calculating the LCM of two Integers.
LCM_2ints.aia (4.4 KB)
You also asked in the Kodular community. It is very disrespectful to ask your question everywhere. Users are spending their free time to help you. Only aak in the community of the builder you use.
I got a recursive solution, and an extension to lists of numbers ...
(I left out validation, for simplicity)
And here is the list based solution ...
The procedures are draggable, the tests not draggable.
The .aia and blocks:
P.S. Thank you for a fun question!
This is the oldest and simplest algorithm for gcd:
https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/the-euclidean-algorithm
Here are some suggestions to improve your code, based on a reading of your blocks: