Smallest multiple

From Rosetta Code
Revision as of 05:43, 21 October 2021 by CalmoSoft (talk | contribs) (Created page with "{{Draft task}} ;Task: <br><br> 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive numbe...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Smallest multiple is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Task



2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

Ring

<lang ring> see "working..." + nl see "Smallest multiple is:" + nl n = 0

while true

     n++
     flag = 0
     for m = 1 to 20
         if n % m = 0
            flag += 1
         ok
     next
     if flag = 20
        see "" + n + nl
        exit
     ok

end

see "done..." + nl </lang>

Output:
working...
Smallest multiple is:
232792560
done...