• We have a few events lined up for the October school holidays!
    Watch this space...

Triangular Number Sequence (1 Viewer)

fan96

617 pages
Joined
May 25, 2017
Messages
463
Location
NSW
Gender
Male
HSC
2018
Uni Grad
2024
By adding another row of dots and counting all the dots we can find the next number of the sequence.
i.e. "count all the rows before, and add a new row".

The algorithm could look like:

Code:
BEGIN
    total = 0
    FOR row = 1 TO 10 STEP 1
        total = total + row
        Display total
    NEXT i
END
Specifically, look at this line:
Code:
 total = total + row
In total + row, total represents the sum of all the rows before, and row is the next row to be added.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top