Sort primes from list to a list: Difference between revisions
Content added Content deleted
(Created page with "{{Draft task}} ;Task: <br> Let given list: <br> Primes = [2,43,81,122,63,13,7,95,103] <<br> Show on this page the ascending ordered list of primes from given list. =={{heade...") |
No edit summary |
||
Line 6:
<br>
Primes = [2,43,81,122,63,13,7,95,103]
Show on this page the ascending ordered list of primes from given list.
|
Revision as of 12:56, 22 January 2022
Sort primes from list to a list 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
Let given list:
Primes = [2,43,81,122,63,13,7,95,103]
Show on this page the ascending ordered list of primes from given list.
Ring
<lang ring> load "stdlibcore.ring" ? "working"
Primes = [2,43,81,122,63,13,7,95,103] Temp = []
for n = 1 to len(Primes)
if isprime(Primes[n]) add(Temp,Primes[n]) ok
next
Temp = sort(Temp) ? Temp ? "done..." </lang>
- Output:
working Primes are: 2 7 13 43 103 done...