Post Reply 
Find LCM of 2 numbers without using GCD
08-01-2018, 09:04 PM (This post was last modified: 08-01-2018 11:28 PM by Albert Chan.)
Post: #22
RE: Find LCM of 2 numbers without using GCD
uh, did it miss a subtract on line 3 ? looks like Y pushed away

when X and Y are both negative, the mod will stay negative all the way to the end

I still like the mod, and would like program to pull double duty.
How about it only does the loop only if X was negative ?

so, this will get the gcd

54321 CHS Enter 12345 CHS R/S --> -3

that will be awesome ...

Edit: my mistake, it was CLX not LstX. That was a nice trick ...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Find LCM of 2 numbers without using GCD - Albert Chan - 08-01-2018 09:04 PM



User(s) browsing this thread: 1 Guest(s)