Last list item: Difference between revisions

Added Easylang
(C++ entry)
(Added Easylang)
 
(One intermediate revision by one other user not shown)
Line 737:
621
 
</pre>
 
 
=={{header|EasyLang}}==
<syntaxhighlight>
l[] = [ 6 81 243 14 25 49 123 69 11 ]
while len l[] > 1
sum = 0
for k to 2
for i to len l[] - 1
if l[i] < l[$]
swap l[i] l[$]
.
.
sum += l[$]
len l[] -1
.
l[] &= sum
print l[]
.
</syntaxhighlight>
{{out}}
<pre>
[ 69 81 243 14 25 49 123 17 ]
[ 123 81 243 69 25 49 31 ]
[ 123 81 243 69 49 56 ]
[ 123 81 243 69 105 ]
[ 123 105 243 150 ]
[ 243 150 228 ]
[ 243 378 ]
[ 621 ]
</pre>
 
Line 1,769 ⟶ 1,800:
=={{header|Wren}}==
===With sorting===
<syntaxhighlight lang="ecmascriptwren">var a = [6, 81, 243, 14, 25, 49, 123, 69, 11]
 
while (a.count > 1) {
Line 1,804 ⟶ 1,835:
 
===Without sorting===
<syntaxhighlight lang="ecmascriptwren">var findMin = Fn.new { |a|
var ix = 0
var min = a[0]
2,063

edits