Sort primes from list to a list: Difference between revisions
Content added Content deleted
No edit summary |
(Noted this is a duplicate task) |
||
Line 8: | Line 8: | ||
<br> |
<br> |
||
Show on this page the ascending ordered list of primes from given list. |
Show on this page the ascending ordered list of primes from given list. |
||
===Duplicate=== |
|||
Surely, this is a duplicate of: [[Sort_an_integer_array]]. |
|||
<br> |
|||
The fact the integers are primes makes no difference to the task. |
|||
<br><br> |
|||
=={{header|Ring}}== |
=={{header|Ring}}== |
Revision as of 13:27, 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.
Duplicate
Surely, this is a duplicate of: Sort_an_integer_array.
The fact the integers are primes makes no difference to the task.
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...