Sum of Array: Difference between revisions
Content deleted Content added
revert spam |
mNo edit summary |
||
Line 1:
[http://liubash.ifrance.com/new/juhnke.htm juhnke] [http://thecakeblog.ifrance.com/articles/bond/ bond] [http://chrystiala.ifrance.com/library/testi-canzoni.htm testi canzoni dell album guilty dei blue] [http://ohmygoshalix.ifrance.com/blog/ragazze-puttane.htm ragazze puttane] [http://ohmygoshalix.ifrance.com/blog/intel-pentium.htm intel pentium 4 3 0 ghz box 1mb] [http://makkiesan.ifrance.com/suite-n.htm suite n 7 handel] [http://emrinalexander.ifrance.com/styles/villaggio-nuraghe.htm villaggio nuraghe] [http://seachildelf.ifrance.com/resources/philips-bcs/ philips 170b5cs] [http://pouringsunny.ifrance.com/description/sofia-marinova/ sofia marinova] [http://thecakeblog.ifrance.com/articles/nvidia-geforce/ nvidia geforce 6600 gt] [http://feelosof.ifrance.com/description/disalberare/ disalberare] [http://cikumuffin.ifrance.com/topic/e-ti/ e ti amo masini] [http://listsobacka.ifrance.com/small/escuela-montalban.htm escuela montalban] [http://chrystiala.ifrance.com/library/evangelista.htm evangelista] [http://pouringsunny.ifrance.com/description/ispettore-ambiente/ ispettore ambiente] [http://feelosof.ifrance.com/description/serra-di/ serra di compostaggio] [http://beatpoetsa.ifrance.com/description/pentium-.htm pentium 4 d] [http://thecakeblog.ifrance.com/articles/tribunale-napoli/ tribunale napoli lavoro] [http://shmarodral.ifrance.com/text/audi-a.htm audi a3 sportback km zero] [http://seachildelf.ifrance.com/resources/midi-mexicana/ midi mexicana] [http://jazzyjoe.ifrance.com/filmer-sir/ filmer sir robert] [http://jojorock.ifrance.com/articles/mp-gb/ mp3 gb divx] [http://seachildelf.ifrance.com/resources/percussionisti/ percussionisti] [http://thecakeblog.ifrance.com/articles/frasi-auguri/ frasi auguri matrimonio ingles] [http://ohmygoshalix.ifrance.com/blog/subaru-outback.htm subaru outback 30] [http://jene7777777.ifrance.com/new/ferro-da.htm ferro da stiro rowenta con caldaia] [http://listsobacka.ifrance.com/small/dial-the.htm dial the] [http://belikan.ifrance.com/library/senza-luce.htm senza luce e colore] [http://jene7777777.ifrance.com/new/prestito-personali.htm prestito personali catania] [http://listsobacka.ifrance.com/small/usb-sd.htm usb sd fm] [http://shotlandetz.ifrance.com/blog/cuffie-con/ cuffie con radio integrata fm] [http://animaetrix00.ifrance.com/content/lancia-y/ lancia y 2001] [http://eccoblackfin.ifrance.com/html/elezioni-europei.htm elezioni europei] [http://seachildelf.ifrance.com/resources/taj-mahal/ taj mahal salon de bahia] [http://listsobacka.ifrance.com/small/galleon-mix.htm galleon mix] [http://emrinalexander.ifrance.com/styles/un-medico.htm un medico in famiglia 5] [http://firejedi.ifrance.com/new/inglesina-emma/ inglesina emma] [http://beatpoetsa.ifrance.com/description/paris-francia.htm paris (francia)] [http://beatpoetsa.ifrance.com/description/di-magia.htm di magia] [http://firejedi.ifrance.com/new/videoclip-smackdown/ videoclip smackdown] [http://liubash.ifrance.com/new/scarpe-onitsuka.htm scarpe onitsuka] [http://jazzyjoe.ifrance.com/hp-p/ hp 4p hp toner] [http://thecakeblog.ifrance.com/articles/cd-peter/ cd peter gabriel] [http://liubash.ifrance.com/new/cercasi-trans.htm cercasi trans] [http://beatpoetsa.ifrance.com/description/gran-turismo.htm gran turismo 4 in musica] [http://jene7777777.ifrance.com/new/viva-la.htm viva la pappa col pomodoro] [http://chrystiala.ifrance.com/library/stivali-collant.htm stivali collant] [http://infunt.ifrance.com/articles/notebook-masterizzatore/ notebook masterizzatore dvd interno] [http://chrystiala.ifrance.com/library/ati-radeon.htm ati radeon 9600 da 256mb 256bit] [http://beatpoetsa.ifrance.com/description/sito-sms.htm sito sms gratis] [http://emrinalexander.ifrance.com/styles/il-motomondiale.htm il motomondiale turbo xt] [http://infunt.ifrance.com/articles/multi-tap/ multi tap ps2] [http://animaetrix00.ifrance.com/content/wild-dance/ wild dance mpe] [http://ohmygoshalix.ifrance.com/blog/e-per.htm e per te] [http://eccoblackfin.ifrance.com/html/morellino-di.htm morellino di scansano] [http://feelosof.ifrance.com/description/brandl-johann/ brandl johann] [http://emrinalexander.ifrance.com/styles/kierra-knightly.htm kierra knightly] [http://jojorock.ifrance.com/articles/pentax-obiettivo/ pentax obiettivo] [http://animaetrix00.ifrance.com/content/il-solitario/ il solitario del west] [http://infunt.ifrance.com/articles/babol-puzle/ babol puzle] [http://eccoblackfin.ifrance.com/html/la-finta.htm la finta giardiniera] [http://emrinalexander.ifrance.com/styles/mirabassi.htm mirabassi] [http://makkiesan.ifrance.com/telecamera-antifurto.htm telecamera antifurto wireless] [http://listsobacka.ifrance.com/small/crea-corpi.htm crea corpi] [http://eccoblackfin.ifrance.com/html/traduzione-moondance.htm traduzione moondance] [http://liubash.ifrance.com/new/ufficio-delle.htm ufficio delle entrate] [http://infunt.ifrance.com/articles/foto-amatoriali/ foto amatoriali di donne spogliate] [http://jazzyjoe.ifrance.com/v-td/ v9999 td 128mb] [http://shotlandetz.ifrance.com/blog/modelli-excel/ modelli excel di contabilita] [http://seachildelf.ifrance.com/resources/bergamotti/ bergamotti] [http://beatpoetsa.ifrance.com/description/gps-nemerix.htm gps nemerix] [http://shotlandetz.ifrance.com/blog/wierni/ wierni] [http://lethalga.ifrance.com/topic/memphis-bells/ memphis bells] [http://shmarodral.ifrance.com/text/senza-scampo.htm senza scampo] [http://thecakeblog.ifrance.com/articles/playstation-joystick/ playstation joystick] [http://beatpoetsa.ifrance.com/description/soap-opera.htm soap opera] [http://pouringsunny.ifrance.com/description/confermato-il/ confermato il ritorno di indiana jones nel 2007] [http://listsobacka.ifrance.com/small/delibes-miguel.htm delibes miguel] [http://shotlandetz.ifrance.com/blog/bertolazzi-carlo/ bertolazzi carlo] [http://pouringsunny.ifrance.com/description/xevo/ xevo] [http://seachildelf.ifrance.com/resources/caccia-anatre/ caccia anatre] [http://emrinalexander.ifrance.com/styles/cieli-azzuri.htm cieli azzuri pupo] [http://chrystiala.ifrance.com/library/amore-s.htm amore s] [http://infunt.ifrance.com/articles/scale-alluminio/ scale alluminio] [http://makkiesan.ifrance.com/deca.htm deca] [http://jene7777777.ifrance.com/new/channel-tv.htm channel tv] [http://feelosof.ifrance.com/description/rivenditori-calabria/ rivenditori calabria] [http://cikumuffin.ifrance.com/topic/philips-cordless/ philips cordless 311] [http://emrinalexander.ifrance.com/styles/lets-go.htm lets go straight] [http://jazzyjoe.ifrance.com/lampada-da/ lampada da testa] [http://shmarodral.ifrance.com/text/decorare-torta.htm decorare torta] [http://jojorock.ifrance.com/articles/enola-gay/ enola gay] [http://ohmygoshalix.ifrance.com/blog/calcio-a.htm calcio a tre] [http://emrinalexander.ifrance.com/styles/microsoft-visual.htm microsoft visual basic] [http://eccoblackfin.ifrance.com/html/la-donna.htm la donna quale animale si scopa] [http://makkiesan.ifrance.com/ricette-per.htm ricette per cucinare il pavone] [http://emrinalexander.ifrance.com/styles/myimmortal-mid.htm myimmortal mid] [http://pouringsunny.ifrance.com/description/is-it/ is it cos i m cod] [http://infunt.ifrance.com/articles/trimone/ trimone] [http://listsobacka.ifrance.com/small/champions-league.htm champions league risultati] [http://liubash.ifrance.com/new/ita-siena.htm ita siena] [http://infunt.ifrance.com/articles/lacie-hard/ lacie hard disk divx] [http://beatpoetsa.ifrance.com/description/casting-gf.htm casting gf5] [http://eccoblackfin.ifrance.com/html/pioneer-dcs.htm pioneer dcs 535] [http://jazzyjoe.ifrance.com/opel-/ opel vectra 25 v6 24v 4p sport] [http://makkiesan.ifrance.com/renato-zero.htm renato zero l equilibrista] [http://beatpoetsa.ifrance.com/description/lebrecht-danilo.htm lebrecht danilo] [http://jojorock.ifrance.com/articles/auto-noleggio/ auto noleggio faenza] [http://emrinalexander.ifrance.com/styles/powerbook-apple.htm powerbook apple] [http://pouringsunny.ifrance.com/description/sd-wi/ sd wi fi] [http://shotlandetz.ifrance.com/blog/silvio-gigli/ silvio gigli] [http://seachildelf.ifrance.com/resources/lexus-rx/ lexus rx 400] [http://jene7777777.ifrance.com/new/fighette-vergini.htm fighette vergini] [http://feelosof.ifrance.com/description/nokia/ nokia 5125] [http://ohmygoshalix.ifrance.com/blog/porno-en.htm porno en dibujos] [http://firejedi.ifrance.com/new/bocelli-vivo/ bocelli vivo per lei] [http://listsobacka.ifrance.com/small/finanziamento-piccola.htm finanziamento piccola impresa] [http://infunt.ifrance.com/articles/villaggio-spagna/ villaggio spagna] [http://animaetrix00.ifrance.com/content/fellowship/ fellowship] [http://liubash.ifrance.com/new/benediro-il.htm benediro il signore] [http://shotlandetz.ifrance.com/blog/traduzione-i/ traduzione i don t want you bach] [http://feelosof.ifrance.com/description/playstation-console/ playstation console ps2] [http://jene7777777.ifrance.com/new/ohne-dich.htm ohne dich rammstein] [http://ohmygoshalix.ifrance.com/blog/racconti-di.htm racconti di sesso con i cavalli] [http://animaetrix00.ifrance.com/content/photo-eminem/ photo eminem] [http://jazzyjoe.ifrance.com/inizio-scuole/ inizio scuole] [http://seachildelf.ifrance.com/resources/canon-mvx/ canon mvx 300] [http://thecakeblog.ifrance.com/articles/scarafaggi/ scarafaggi] [http://lethalga.ifrance.com/topic/before-you/ before you acuse me] [http://jazzyjoe.ifrance.com/scuola-di/ scuola di liuteria] [http://jene7777777.ifrance.com/new/keynes-john.htm keynes john neville] [http://cikumuffin.ifrance.com/topic/esecuzione-ostaggi/ esecuzione ostaggi] [http://shotlandetz.ifrance.com/blog/ronald-reagan/ ronald reagan] [http://jene7777777.ifrance.com/new/bluetooth-mini.htm bluetooth mini keyboard] [http://shotlandetz.ifrance.com/blog/jeanette-hold/ jeanette hold the line] [http://emrinalexander.ifrance.com/styles/dvd-film.htm dvd film gratis] [http://firejedi.ifrance.com/new/pajas/ pajas] [http://shotlandetz.ifrance.com/blog/i-vinti/ i vinti] [http://animaetrix00.ifrance.com/content/lavaggio-auto/ lavaggio auto] [http://firejedi.ifrance.com/new/iceberg-effusion/ iceberg effusion] [http://lethalga.ifrance.com/topic/panasonic-nv/ panasonic nv gs22] [http://jene7777777.ifrance.com/new/forem.htm forem] [http://jene7777777.ifrance.com/new/copertina-cd.htm copertina cd hit mania dance 2006] [http://emrinalexander.ifrance.com/styles/actua-tennis.htm actua tennis] [http://ohmygoshalix.ifrance.com/blog/wwww-sms.htm wwww sms it] [http://belikan.ifrance.com/library/cuore-uno.htm cuore uno zingaro] [http://emrinalexander.ifrance.com/styles/mamma-di.htm mamma di un angelo] [http://infunt.ifrance.com/articles/webcam-live/ webcam live pro] [http://makkiesan.ifrance.com/piera.htm piera] [http://listsobacka.ifrance.com/small/una-demo.htm una demo per airport tycoon 2] [http://belikan.ifrance.com/library/decoder-usb.htm decoder usb pc] [http://emrinalexander.ifrance.com/styles/tv-plasma.htm tv plasma 42 phs] [http://animaetrix00.ifrance.com/content/ubanghi/ ubanghi] [http://ohmygoshalix.ifrance.com/blog/wwww-mappy.htm wwww mappy com] [http://seachildelf.ifrance.com/resources/brother-c/ brother 210c] [http://feelosof.ifrance.com/description/concerto-pfm/ concerto pfm monza] [http://emrinalexander.ifrance.com/styles/premi-tesi.htm premi tesi] [http://pouringsunny.ifrance.com/description/billinger-richard/ billinger richard] [http://lethalga.ifrance.com/topic/fermata-per/ fermata per dodici ore] [http://feelosof.ifrance.com/description/justine-una/ justine una relazione privata] [http://thecakeblog.ifrance.com/articles/wawes-of/ wawes of luv midi 2 black] [http://beatpoetsa.ifrance.com/description/alicebusiness-it.htm alicebusiness it] [http://shotlandetz.ifrance.com/blog/ricette-di/ ricette di verdure] [http://seachildelf.ifrance.com/resources/navigatori-car/ navigatori car gps] [http://seachildelf.ifrance.com/resources/eos-ds/ eos 1ds canon] [http://shmarodral.ifrance.com/text/abbigliamento-uomo.htm abbigliamento uomo energie] [http://feelosof.ifrance.com/description/racconti-porno/ racconti porno gay] [http://cikumuffin.ifrance.com/topic/stampanti-hp/ stampanti hp laserjet 2550n] [http://makkiesan.ifrance.com/collane-vetro.htm collane vetro] [http://jojorock.ifrance.com/articles/hockey-ice/ hockey ice] [http://jene7777777.ifrance.com/new/dvd-.htm dvd 1 4gb] [http://infunt.ifrance.com/articles/instant-video/ instant video] [http://jazzyjoe.ifrance.com/graz-cose/ graz cose fare] [http://belikan.ifrance.com/library/mobile-cristallo.htm mobile cristallo plasma] [http://cikumuffin.ifrance.com/topic/furness/ furness] [http://animaetrix00.ifrance.com/content/overlap/ overlap] [http://liubash.ifrance.com/new/vfa.htm vfa] [http://chrystiala.ifrance.com/library/bleh.htm bleh] [http://thecakeblog.ifrance.com/articles/matrox-rtx/ matrox rtx10] [http://emrinalexander.ifrance.com/styles/yasmine-bleeth.htm yasmine bleeth nuda] [http://infunt.ifrance.com/articles/cecilia-finotti/ cecilia finotti] [http://shotlandetz.ifrance.com/blog/iriver-ifp/ iriver ifp] [http://lethalga.ifrance.com/topic/squadra-francese/ squadra francese nuda] [http://liubash.ifrance.com/new/harjai.htm harjai] [http://thecakeblog.ifrance.com/articles/pontignano-siena/ pontignano siena] [http://cikumuffin.ifrance.com/topic/lesbianas/ lesbianas] [http://animaetrix00.ifrance.com/content/asus-anxla/ asus a7n8xla] [http://beatpoetsa.ifrance.com/description/bebe-confort.htm bebe confort iseos] [http://beatpoetsa.ifrance.com/description/stai-con.htm stai con meu] [http://shotlandetz.ifrance.com/blog/inglese-corso/ inglese corso] [http://emrinalexander.ifrance.com/styles/giochi-calcio.htm giochi calcio pc] [http://pouringsunny.ifrance.com/description/garou-esmeralda/ garou esmeralda] [http://chrystiala.ifrance.com/library/batteria-sony.htm batteria sony t630] [http://feelosof.ifrance.com/description/paco-de/ paco de lucia light and shade] [http://shotlandetz.ifrance.com/blog/nikon-mh/ nikon mh53] [http://makkiesan.ifrance.com/marlyn-manson.htm marlyn manson] [http://pouringsunny.ifrance.com/description/cosmetico-prodotti/ cosmetico prodotti bellezza] [http://belikan.ifrance.com/library/gran-turismo.htm gran turismo 4 potrebbe ritardare anche in usa] [http://jazzyjoe.ifrance.com/leatherman-wave/ leatherman wave] [http://lethalga.ifrance.com/topic/mp-mb/ mp3 128mb] [http://animaetrix00.ifrance.com/content/everybodies-change/ everybodies change kings] [http://jojorock.ifrance.com/articles/panasonic-scpm/ panasonic scpm21] [http://shmarodral.ifrance.com/text/dvd-rw.htm dvd rw esterno firewire] [http://cikumuffin.ifrance.com/topic/vampire-the/ vampire the masquerade bloodlines] [http://jazzyjoe.ifrance.com/video-dell/ video dell attentato in america dell 11] [http://seachildelf.ifrance.com/resources/senza-far/ senza far rumore] [http://eccoblackfin.ifrance.com/html/libera-professione.htm libera professione] [http://shmarodral.ifrance.com/text/foto-berry.htm foto berry white] [http://jazzyjoe.ifrance.com/volkswagen-golf/ volkswagen golf 1600] [http://animaetrix00.ifrance.com/content/monitor-lcd/ monitor lcd dvi 19] [http://listsobacka.ifrance.com/small/liviu-vasilica.htm liviu vasilica] [http://listsobacka.ifrance.com/small/misurini.htm misurini] [http://jene7777777.ifrance.com/new/www-movilnet.htm www movilnet com] [http://liubash.ifrance.com/new/emp.htm emp 30] [http://animaetrix00.ifrance.com/content/dedicato-a/ dedicato a una stella] [http://belikan.ifrance.com/library/hotel-caesar.htm hotel caesar] [http://jazzyjoe.ifrance.com/nuevas-normas/ nuevas normas de trafico] [http://feelosof.ifrance.com/description/due-di/ due di raf] [http://chrystiala.ifrance.com/library/mac-speaker.htm mac speaker e cuffie] [http://shotlandetz.ifrance.com/blog/procedure-delle/ procedure delle asl] [http://feelosof.ifrance.com/description/testo-canzone/ testo canzone aicha in italiano] [http://listsobacka.ifrance.com/small/tram.htm tram] [http://beatpoetsa.ifrance.com/description/elenco-rivenditori.htm elenco rivenditori fossil toscana] [http://lethalga.ifrance.com/topic/duplex-/ duplex un appartamento per tre] [http://liubash.ifrance.com/new/week-end.htm week end a parigi] [http://shmarodral.ifrance.com/text/athlete.htm athlete] [http://animaetrix00.ifrance.com/content/il-portiere/ il portiere di notte enrico ruggeri] [http://eccoblackfin.ifrance.com/html/o-c.htm o c soundtrack] [http://jazzyjoe.ifrance.com/srl-studio/ srl studio consulenza tributaria e del lavoro roma] [http://thecakeblog.ifrance.com/articles/fotos-di/ fotos di donas colombianas] [http://ohmygoshalix.ifrance.com/blog/calendari-george.htm calendari george clooney] [http://infunt.ifrance.com/articles/jennifer-hawkins/ jennifer hawkins nude] [http://jene7777777.ifrance.com/new/kate-rose.htm kate rose] [http://ohmygoshalix.ifrance.com/blog/codici-tps.htm codici tps] [http://makkiesan.ifrance.com/sviluppa-numeri.htm sviluppa numeri superenalotto] [http://ohmygoshalix.ifrance.com/blog/macchina-per.htm macchina per il pane delonghi] [http://thecakeblog.ifrance.com/articles/desiderando-giulia/ desiderando giulia] [http://firejedi.ifrance.com/new/ubuntu/ ubuntu] [http://liubash.ifrance.com/new/e-ti.htm e ti amo] [http://shmarodral.ifrance.com/text/tariffa-notaio.htm tariffa notaio] [http://makkiesan.ifrance.com/frasi-di.htm frasi di ringraziamento per lutto] [http://feelosof.ifrance.com/description/gioco-sony/ gioco sony ericsson p800] [http://feelosof.ifrance.com/description/la-notte/ la notte della taranta cd dvd] [http://lethalga.ifrance.com/topic/tutto-quello/ tutto quello che un uomo puo fare] [http://jazzyjoe.ifrance.com/jimny-suzuki/ jimny suzuki] [http://thecakeblog.ifrance.com/articles/jonni-dorelli/ jonni dorelli] [http://shmarodral.ifrance.com/text/codice-magnum.htm codice magnum] [http://lethalga.ifrance.com/topic/i-cavalieri/ i cavalieri del drago giorgio vanni] [http://jene7777777.ifrance.com/new/jeff-stryker.htm jeff stryker] [http://listsobacka.ifrance.com/small/www-gta.htm www gta vice city it] {{task}}
Compute the sum of the elements of an Array
Line 11:
$var:=0
For ($i;1;Size of array($list))
$var:=$var
End for
Line 20:
Sum : Integer := 0;
for I in Int_Array'range loop
Sum := Sum
end loop;
Line 30:
repeat with i in array
-- very important -- list index starts at 1 not 0
set product to product
end repeat
Line 42:
50 REM Find the sum of elements in the array
60 SUM = 0
70 FOR I = 1 TO 5: SUM = SUM
80 PRINT "The sum is ";SUM
==[[C plus plus|C
[[Category:C plus plus]]
Line 55:
int list[] = { 1, 2, 3 } ;
int sum = 0 ;
for( int i = 0 ; i < 3 ; i
{
sum
}
}
Line 69:
{
int list[] = { 1, 2, 3 } ;
std::accumulate(list, list
return 0;
}
Line 78:
{
T accum = 0;
for (unsigned i=0; i<n; i
accum
return accum;
}
Line 103:
int arg_length = arg.Length;
for( int i = 0; i < arg_length; i
value
Line 111:
int sum = 0;
int[] arg = { 1, 2, 3, 4, 5 };
foreach (int value in arg) sum
==[[Clean]]==
Line 128:
(defparameter *data* #(1 2 3 4 5))
(reduce #'
==[[Delphi]]==
Line 146:
pragma.enable("accumulator")
accum 0 for x in [1,2,3,4,5] { _
==[[Erlang]]==
Line 157:
% and compute its sum:
2000
S = lists:sum(L).
Line 168 ⟶ 170:
0;
sum_rec([Head|Tail]) ->
Head
% tail-recursive definition:
Line 176 ⟶ 178:
Acc;
sum_tail([Head|Tail], Acc) ->
sum_tail(Tail, Head
==[[Forth]]==
Line 183 ⟶ 185:
: sum ( addr cnt -- n )
0 -rot
cells bounds do i @
Line 193 ⟶ 195:
dim sum as integer = 0
for index as integer = lbound(array) to ubound(array)
sum
next
Line 201 ⟶ 203:
let values = [1..10]
sum values -- the easy way
foldl (
==[[IDL]]==
Line 214 ⟶ 216:
int[] arg = new int[] { 1,2,3,4,5 };
for (int i: arg)
value
==[[JavaScript]]==
Line 222 ⟶ 224:
var sum = 0;
for(var i in array)
sum
==[[Perl]]==
Line 230 ⟶ 232:
my $var;
my @list = (1, 2, 3);
$var
Alternate
Line 245 ⟶ 247:
my $acc = 0;
my @list = qw(1 2 3)
map { $acc
==[[PHP]]==
Line 260 ⟶ 262:
lvars i, sum = 0, ar = {1 2 3 4 5 6 7 8 9};
for i from 1 to length(ar) do
ar(i)
endfor;
Line 266 ⟶ 268:
lvars sum = 0, ar = {1 2 3 4 5 6 7 8 9};
appdata(ar, procedure(x); x
==[[Prolog]]==
[[Category:Prolog]]
sum([],0).
sum([H|T],X) :- sum(T,Y), X is H
test
:- sum([1,2,3,4,5,6,7,8,9],X).
Line 286 ⟶ 288:
ary = [1,2,3,4,5]
sum = ary.inject{|currentSum,element|currentSum
# => 15
Line 292 ⟶ 294:
[[Category:Scala]]
val array = Array(1,2,3,4,5)
val sum = array.foldLeft(0)(_
This is a shortcut for
val sum = array.foldLeft(0){(currentSum, element) => currentSum
==[[Seed7]]==
Line 307 ⟶ 309:
begin
for value range valueArray do
sum
end for;
end func;
Line 319 ⟶ 321:
val array = [1,2,3,4,5];
foldl op
==[[Tcl]]==
Line 326 ⟶ 328:
Assuming the values are in a list named <tt>listname</tt>:
set result [expr [join $listname
==[[Toka]]==
Line 332 ⟶ 334:
[ ( array size -- sum )
>r 0 r> [ over i swap get-element
==[[UNIX Shell]]==
Line 344 ⟶ 346:
list="1 2 3"
for n in $list
do sum="$(($sum
done
echo $sum
Line 352 ⟶ 354:
sum=0
for n
do sum="$(($sum
done
echo $sum
Line 360 ⟶ 362:
sum=0
while read n
do sum="$(($sum
done
echo $sum
Line 371 ⟶ 373:
SUM=0;
for i in $LIST; do
SUM=$[$SUM
done;
echo $SUM
|