Sort primes from list to a list
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...