Accumulator Simple Lists Tutorial

From Progzoo
Revision as of 20:22, 12 September 2012 by 08014201 (Talk | contribs) (Count Even Numbers)

Jump to: navigation, search

Sum

Print the total of all of the numbers

  • We initialise to 0.
  • We add to the accumulator.


[Font] [Default] [Show] [Resize] [History] [Profile]

Product

Print the product of all of the numbers.

  • We initialise to 1.
  • We multiply the accumulator.


[Font] [Default] [Show] [Resize] [History] [Profile]

Min

Print the smallest item in the list.


[Font] [Default] [Show] [Resize] [History] [Profile]

Count Small Numbers

Print the number of numbers less than 3.


[Font] [Default] [Show] [Resize] [History] [Profile]

Sum Small Numbers

Print the sum of number of numbers less than 3.


[Font] [Default] [Show] [Resize] [History] [Profile]

Count Even Numbers

Print the number of even numbers.


[Font] [Default] [Show] [Resize] [History] [Profile]