The LCM of two integers n1 and n2 is the smallest positive integer that is perfectly divisible by both n1 and n2 (without a remainder)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
BEGIN NUMBER n1 , n2 , lcm; OUTPUT "Enter first Number:"; INPUT n1 OUTPUT "Enter second Number:"; INPUT n2 lcm = (n1 > n2) ? n1 : n2; WHILE (true) THEN IF (lcm % n1 == 0 && lcm % n2 == 0) THEN OUTPUT "The LCM of "+n1+"and "+n2+" is "+ lcm; BREAK WHILE; END IF ++lcm; END WHILE END |
Flowchart